home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1988-11-30 | 30.0 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| ZX81 Sinclair BASIC (image/sinclairBASIC)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| bsdiff patch (other/bsdiffPatch)
| ext
| Unsupported |
1%
| dexvert
| imgdiff patch (other/imgdiffPatch)
| ext
| Unsupported |
1%
| dexvert
| WSUS Patch Storage File (other/wsusPatchStorageFile)
| ext
| Unsupported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Wed Nov 30 12:00:00 1988, modified Wed Nov 30 12:00:00 1988, creator 'MPS ', type ASCII, 30025 bytes "Sample.p" , at 0x75c9 431 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 53 61 6d 70 6c 65 | 2e 70 00 00 00 00 00 00 |..Sample|.p......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 75 49 00 | 00 01 af 9f b9 d9 90 9f |.....uI.|........|
|00000060| b9 d9 90 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 3f dd 00 00 |........|....?...|
|00000080| 7b 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |{-------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|000000d0| 23 0d 23 09 41 70 70 6c | 65 20 4d 61 63 69 6e 74 |#.#.Appl|e Macint|
|000000e0| 6f 73 68 20 44 65 76 65 | 6c 6f 70 65 72 20 54 65 |osh Deve|loper Te|
|000000f0| 63 68 6e 69 63 61 6c 20 | 53 75 70 70 6f 72 74 0d |chnical |Support.|
|00000100| 23 0d 23 09 4d 75 6c 74 | 69 46 69 6e 64 65 72 2d |#.#.Mult|iFinder-|
|00000110| 41 77 61 72 65 20 53 69 | 6d 70 6c 65 20 53 61 6d |Aware Si|mple Sam|
|00000120| 70 6c 65 20 41 70 70 6c | 69 63 61 74 69 6f 6e 0d |ple Appl|ication.|
|00000130| 23 0d 23 09 53 61 6d 70 | 6c 65 0d 23 0d 23 09 53 |#.#.Samp|le.#.#.S|
|00000140| 61 6d 70 6c 65 2e 70 09 | 2d 09 50 61 73 63 61 6c |ample.p.|-.Pascal|
|00000150| 20 53 6f 75 72 63 65 0d | 23 0d 23 09 43 6f 70 79 | Source.|#.#.Copy|
|00000160| 72 69 67 68 74 20 a9 20 | 31 39 38 38 20 41 70 70 |right . |1988 App|
|00000170| 6c 65 20 43 6f 6d 70 75 | 74 65 72 2c 20 49 6e 63 |le Compu|ter, Inc|
|00000180| 2e 0d 23 09 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |..#.All |rights r|
|00000190| 65 73 65 72 76 65 64 2e | 0d 23 0d 23 09 56 65 72 |eserved.|.#.#.Ver|
|000001a0| 73 69 6f 6e 73 3a 09 31 | 2e 30 09 09 09 09 09 30 |sions:.1|.0.....0|
|000001b0| 38 2f 38 38 0d 23 09 09 | 09 09 31 2e 30 31 09 09 |8/88.#..|..1.01..|
|000001c0| 09 09 31 31 2f 38 38 0d | 23 0d 23 09 43 6f 6d 70 |..11/88.|#.#.Comp|
|000001d0| 6f 6e 65 6e 74 73 3a 09 | 53 61 6d 70 6c 65 2e 70 |onents:.|Sample.p|
|000001e0| 09 09 09 4e 6f 76 65 6d | 62 65 72 20 31 2c 20 31 |...Novem|ber 1, 1|
|000001f0| 39 38 38 0d 23 09 09 09 | 09 53 61 6d 70 6c 65 2e |988.#...|.Sample.|
|00000200| 63 09 09 09 4e 6f 76 65 | 6d 62 65 72 20 31 2c 20 |c...Nove|mber 1, |
|00000210| 31 39 38 38 0d 23 09 09 | 09 09 53 61 6d 70 6c 65 |1988.#..|..Sample|
|00000220| 2e 61 09 09 09 4e 6f 76 | 65 6d 62 65 72 20 31 2c |.a...Nov|ember 1,|
|00000230| 20 31 39 38 38 0d 23 09 | 09 09 09 53 61 6d 70 6c | 1988.#.|...Sampl|
|00000240| 65 2e 69 6e 63 31 2e 61 | 09 09 4e 6f 76 65 6d 62 |e.inc1.a|..Novemb|
|00000250| 65 72 20 31 2c 20 31 39 | 38 38 0d 23 09 09 09 09 |er 1, 19|88.#....|
|00000260| 53 61 6d 70 6c 65 4d 69 | 73 63 2e 61 09 09 4e 6f |SampleMi|sc.a..No|
|00000270| 76 65 6d 62 65 72 20 31 | 2c 20 31 39 38 38 0d 23 |vember 1|, 1988.#|
|00000280| 09 09 09 09 53 61 6d 70 | 6c 65 2e 72 09 09 09 4e |....Samp|le.r...N|
|00000290| 6f 76 65 6d 62 65 72 20 | 31 2c 20 31 39 38 38 0d |ovember |1, 1988.|
|000002a0| 23 09 09 09 09 53 61 6d | 70 6c 65 2e 68 09 09 09 |#....Sam|ple.h...|
|000002b0| 4e 6f 76 65 6d 62 65 72 | 20 31 2c 20 31 39 38 38 |November| 1, 1988|
|000002c0| 0d 23 09 09 09 09 5b 41 | 5d 53 61 6d 70 6c 65 2e |.#....[A|]Sample.|
|000002d0| 6d 61 6b 65 09 09 4e 6f | 76 65 6d 62 65 72 20 31 |make..No|vember 1|
|000002e0| 2c 20 31 39 38 38 0d 23 | 09 09 09 09 5b 43 5d 53 |, 1988.#|....[C]S|
|000002f0| 61 6d 70 6c 65 2e 6d 61 | 6b 65 09 09 4e 6f 76 65 |ample.ma|ke..Nove|
|00000300| 6d 62 65 72 20 31 2c 20 | 31 39 38 38 0d 23 09 09 |mber 1, |1988.#..|
|00000310| 09 09 5b 50 5d 53 61 6d | 70 6c 65 2e 6d 61 6b 65 |..[P]Sam|ple.make|
|00000320| 09 09 4e 6f 76 65 6d 62 | 65 72 20 31 2c 20 31 39 |..Novemb|er 1, 19|
|00000330| 38 38 0d 23 0d 23 09 53 | 61 6d 70 6c 65 20 69 73 |88.#.#.S|ample is|
|00000340| 20 61 6e 20 65 78 61 6d | 70 6c 65 20 61 70 70 6c | an exam|ple appl|
|00000350| 69 63 61 74 69 6f 6e 20 | 74 68 61 74 20 64 65 6d |ication |that dem|
|00000360| 6f 6e 73 74 72 61 74 65 | 73 20 68 6f 77 20 74 6f |onstrate|s how to|
|00000370| 0d 23 09 69 6e 69 74 69 | 61 6c 69 7a 65 20 74 68 |.#.initi|alize th|
|00000380| 65 20 63 6f 6d 6d 6f 6e | 6c 79 20 75 73 65 64 20 |e common|ly used |
|00000390| 74 6f 6f 6c 62 6f 78 20 | 6d 61 6e 61 67 65 72 73 |toolbox |managers|
|000003a0| 2c 20 6f 70 65 72 61 74 | 65 20 0d 23 09 73 75 63 |, operat|e .#.suc|
|000003b0| 63 65 73 73 66 75 6c 6c | 79 20 75 6e 64 65 72 20 |cessfull|y under |
|000003c0| 4d 75 6c 74 69 46 69 6e | 64 65 72 2c 20 68 61 6e |MultiFin|der, han|
|000003d0| 64 6c 65 20 64 65 73 6b | 20 61 63 63 65 73 73 6f |dle desk| accesso|
|000003e0| 72 69 65 73 2c 20 0d 23 | 09 61 6e 64 20 63 72 65 |ries, .#|.and cre|
|000003f0| 61 74 65 2c 20 67 72 6f | 77 2c 20 61 6e 64 20 7a |ate, gro|w, and z|
|00000400| 6f 6f 6d 20 77 69 6e 64 | 6f 77 73 2e 0d 23 0d 23 |oom wind|ows..#.#|
|00000410| 09 49 74 20 64 6f 65 73 | 20 6e 6f 74 20 62 79 20 |.It does| not by |
|00000420| 61 6e 79 20 6d 65 61 6e | 73 20 64 65 6d 6f 6e 73 |any mean|s demons|
|00000430| 74 72 61 74 65 20 61 6c | 6c 20 74 68 65 20 74 65 |trate al|l the te|
|00000440| 63 68 6e 69 71 75 65 73 | 20 0d 23 09 79 6f 75 20 |chniques| .#.you |
|00000450| 6e 65 65 64 20 66 6f 72 | 20 61 20 6c 61 72 67 65 |need for| a large|
|00000460| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 2e 20 49 6e | applica|tion. In|
|00000470| 20 70 61 72 74 69 63 75 | 6c 61 72 2c 20 53 61 6d | particu|lar, Sam|
|00000480| 70 6c 65 20 0d 23 09 64 | 6f 65 73 20 6e 6f 74 20 |ple .#.d|oes not |
|00000490| 63 6f 76 65 72 20 65 78 | 63 65 70 74 69 6f 6e 20 |cover ex|ception |
|000004a0| 68 61 6e 64 6c 69 6e 67 | 2c 20 6d 75 6c 74 69 70 |handling|, multip|
|000004b0| 6c 65 20 77 69 6e 64 6f | 77 73 2f 64 6f 63 75 6d |le windo|ws/docum|
|000004c0| 65 6e 74 73 2c 20 0d 23 | 09 73 6f 70 68 69 73 74 |ents, .#|.sophist|
|000004d0| 69 63 61 74 65 64 20 6d | 65 6d 6f 72 79 20 6d 61 |icated m|emory ma|
|000004e0| 6e 61 67 65 6d 65 6e 74 | 2c 20 70 72 69 6e 74 69 |nagement|, printi|
|000004f0| 6e 67 2c 20 6f 72 20 75 | 6e 64 6f 2e 20 41 6c 6c |ng, or u|ndo. All|
|00000500| 20 6f 66 20 0d 23 09 74 | 68 65 73 65 20 61 72 65 | of .#.t|hese are|
|00000510| 20 76 69 74 61 6c 20 70 | 61 72 74 73 20 6f 66 20 | vital p|arts of |
|00000520| 61 20 6e 6f 72 6d 61 6c | 20 66 75 6c 6c 2d 73 69 |a normal| full-si|
|00000530| 7a 65 64 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2e |zed appl|ication.|
|00000540| 0d 23 0d 23 09 54 68 69 | 73 20 61 70 70 6c 69 63 |.#.#.Thi|s applic|
|00000550| 61 74 69 6f 6e 20 69 73 | 20 61 6e 20 65 78 61 6d |ation is| an exam|
|00000560| 70 6c 65 20 6f 66 20 74 | 68 65 20 66 6f 72 6d 20 |ple of t|he form |
|00000570| 6f 66 20 61 20 4d 61 63 | 69 6e 74 6f 73 68 20 0d |of a Mac|intosh .|
|00000580| 23 09 61 70 70 6c 69 63 | 61 74 69 6f 6e 3b 20 69 |#.applic|ation; i|
|00000590| 74 20 69 73 20 4e 4f 54 | 20 61 20 74 65 6d 70 6c |t is NOT| a templ|
|000005a0| 61 74 65 2e 20 49 74 20 | 69 73 20 4e 4f 54 20 69 |ate. It |is NOT i|
|000005b0| 6e 74 65 6e 64 65 64 20 | 74 6f 20 62 65 20 0d 23 |ntended |to be .#|
|000005c0| 09 75 73 65 64 20 61 73 | 20 61 20 66 6f 75 6e 64 |.used as| a found|
|000005d0| 61 74 69 6f 6e 20 66 6f | 72 20 74 68 65 20 6e 65 |ation fo|r the ne|
|000005e0| 78 74 20 77 6f 72 6c 64 | 2d 63 6c 61 73 73 2c 20 |xt world|-class, |
|000005f0| 62 65 73 74 2d 73 65 6c | 6c 69 6e 67 2c 20 0d 23 |best-sel|ling, .#|
|00000600| 09 36 30 30 4b 20 61 70 | 70 6c 69 63 61 74 69 6f |.600K ap|plicatio|
|00000610| 6e 2e 20 41 20 73 74 69 | 63 6b 20 66 69 67 75 72 |n. A sti|ck figur|
|00000620| 65 20 64 72 61 77 69 6e | 67 20 6f 66 20 74 68 65 |e drawin|g of the|
|00000630| 20 68 75 6d 61 6e 20 62 | 6f 64 79 20 6d 61 79 20 | human b|ody may |
|00000640| 0d 23 09 62 65 20 61 20 | 67 6f 6f 64 20 65 78 61 |.#.be a |good exa|
|00000650| 6d 70 6c 65 20 6f 66 20 | 74 68 65 20 66 6f 72 6d |mple of |the form|
|00000660| 20 66 6f 72 20 61 20 70 | 61 69 6e 74 69 6e 67 2c | for a p|ainting,|
|00000670| 20 62 75 74 20 74 68 61 | 74 20 64 6f 65 73 20 6e | but tha|t does n|
|00000680| 6f 74 20 0d 23 09 6d 65 | 61 6e 20 69 74 20 73 68 |ot .#.me|an it sh|
|00000690| 6f 75 6c 64 20 62 65 20 | 75 73 65 64 20 61 73 20 |ould be |used as |
|000006a0| 74 68 65 20 62 61 73 69 | 73 20 66 6f 72 20 74 68 |the basi|s for th|
|000006b0| 65 20 6e 65 78 74 20 4d | 6f 6e 61 20 4c 69 73 61 |e next M|ona Lisa|
|000006c0| 2e 0d 23 0d 23 09 57 65 | 20 72 65 63 6f 6d 6d 65 |..#.#.We| recomme|
|000006d0| 6e 64 20 74 68 61 74 20 | 79 6f 75 20 72 65 76 69 |nd that |you revi|
|000006e0| 65 77 20 74 68 69 73 20 | 70 72 6f 67 72 61 6d 20 |ew this |program |
|000006f0| 6f 72 20 54 45 53 61 6d | 70 6c 65 20 62 65 66 6f |or TESam|ple befo|
|00000700| 72 65 20 0d 23 09 62 65 | 67 69 6e 6e 69 6e 67 20 |re .#.be|ginning |
|00000710| 61 20 6e 65 77 20 61 70 | 70 6c 69 63 61 74 69 6f |a new ap|plicatio|
|00000720| 6e 2e 0d 23 0d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |n..#.---|--------|
|00000730| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000740| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000750| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000760| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000770| 2d 2d 2d 7d 0d 0d 0d 50 | 52 4f 47 52 41 4d 20 53 |---}...P|ROGRAM S|
|00000780| 61 6d 70 6c 65 3b 0d 0d | 0d 7b 53 65 67 6d 65 6e |ample;..|.{Segmen|
|00000790| 74 61 74 69 6f 6e 20 73 | 74 72 61 74 65 67 79 3a |tation s|trategy:|
|000007a0| 0d 0d 20 54 68 69 73 20 | 70 72 6f 67 72 61 6d 20 |.. This |program |
|000007b0| 63 6f 6e 73 69 73 74 73 | 20 6f 66 20 74 68 72 65 |consists| of thre|
|000007c0| 65 20 73 65 67 6d 65 6e | 74 73 2e 20 4d 61 69 6e |e segmen|ts. Main|
|000007d0| 20 63 6f 6e 74 61 69 6e | 73 20 6d 6f 73 74 20 6f | contain|s most o|
|000007e0| 66 20 74 68 65 20 63 6f | 64 65 2c 0d 20 69 6e 63 |f the co|de,. inc|
|000007f0| 6c 75 64 69 6e 67 20 74 | 68 65 20 4d 50 57 20 6c |luding t|he MPW l|
|00000800| 69 62 72 61 72 69 65 73 | 2c 20 61 6e 64 20 74 68 |ibraries|, and th|
|00000810| 65 20 6d 61 69 6e 20 70 | 72 6f 67 72 61 6d 2e 20 |e main p|rogram. |
|00000820| 49 6e 69 74 69 61 6c 69 | 7a 65 20 63 6f 6e 74 61 |Initiali|ze conta|
|00000830| 69 6e 73 0d 20 63 6f 64 | 65 20 74 68 61 74 20 69 |ins. cod|e that i|
|00000840| 73 20 6f 6e 6c 79 20 75 | 73 65 64 20 6f 6e 63 65 |s only u|sed once|
|00000850| 2c 20 64 75 72 69 6e 67 | 20 73 74 61 72 74 75 70 |, during| startup|
|00000860| 2c 20 61 6e 64 20 63 61 | 6e 20 62 65 20 75 6e 6c |, and ca|n be unl|
|00000870| 6f 61 64 65 64 20 61 66 | 74 65 72 20 74 68 65 0d |oaded af|ter the.|
|00000880| 20 70 72 6f 67 72 61 6d | 20 73 74 61 72 74 73 2e | program| starts.|
|00000890| 20 25 41 35 49 6e 69 74 | 20 69 73 20 61 75 74 6f | %A5Init| is auto|
|000008a0| 6d 61 74 69 63 61 6c 6c | 79 20 63 72 65 61 74 65 |maticall|y create|
|000008b0| 64 20 62 79 20 74 68 65 | 20 4c 69 6e 6b 65 72 20 |d by the| Linker |
|000008c0| 74 6f 20 69 6e 69 74 69 | 61 6c 69 7a 65 0d 20 67 |to initi|alize. g|
|000008d0| 6c 6f 62 61 6c 73 20 66 | 6f 72 20 74 68 65 20 4d |lobals f|or the M|
|000008e0| 50 57 20 6c 69 62 72 61 | 72 69 65 73 20 61 6e 64 |PW libra|ries and|
|000008f0| 20 69 73 20 75 6e 6c 6f | 61 64 65 64 20 72 69 67 | is unlo|aded rig|
|00000900| 68 74 20 61 77 61 79 2e | 7d 0d 0d 0d 7b 53 65 74 |ht away.|}...{Set|
|00000910| 50 6f 72 74 20 73 74 72 | 61 74 65 67 79 3a 0d 0d |Port str|ategy:..|
|00000920| 20 54 6f 6f 6c 62 6f 78 | 20 72 6f 75 74 69 6e 65 | Toolbox| routine|
|00000930| 73 20 64 6f 20 6e 6f 74 | 20 63 68 61 6e 67 65 20 |s do not| change |
|00000940| 74 68 65 20 63 75 72 72 | 65 6e 74 20 70 6f 72 74 |the curr|ent port|
|00000950| 2e 20 49 6e 20 73 70 69 | 74 65 20 6f 66 20 74 68 |. In spi|te of th|
|00000960| 69 73 2c 20 69 6e 20 74 | 68 69 73 0d 20 70 72 6f |is, in t|his. pro|
|00000970| 67 72 61 6d 20 77 65 20 | 75 73 65 20 61 20 73 74 |gram we |use a st|
|00000980| 72 61 74 65 67 79 20 6f | 66 20 63 61 6c 6c 69 6e |rategy o|f callin|
|00000990| 67 20 53 65 74 50 6f 72 | 74 20 77 68 65 6e 65 76 |g SetPor|t whenev|
|000009a0| 65 72 20 77 65 20 77 61 | 6e 74 20 74 6f 20 64 72 |er we wa|nt to dr|
|000009b0| 61 77 20 6f 72 0d 20 6d | 61 6b 65 20 63 61 6c 6c |aw or. m|ake call|
|000009c0| 73 20 77 68 69 63 68 20 | 64 65 70 65 6e 64 20 6f |s which |depend o|
|000009d0| 6e 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 70 6f |n the cu|rrent po|
|000009e0| 72 74 2e 20 54 68 69 73 | 20 6d 61 6b 65 73 20 75 |rt. This| makes u|
|000009f0| 73 20 6c 65 73 73 20 76 | 75 6c 6e 65 72 61 62 6c |s less v|ulnerabl|
|00000a00| 65 0d 20 74 6f 20 62 75 | 67 73 20 69 6e 20 6f 74 |e. to bu|gs in ot|
|00000a10| 68 65 72 20 73 6f 66 74 | 77 61 72 65 20 77 68 69 |her soft|ware whi|
|00000a20| 63 68 20 6d 69 67 68 74 | 20 61 6c 74 65 72 20 74 |ch might| alter t|
|00000a30| 68 65 20 63 75 72 72 65 | 6e 74 20 70 6f 72 74 20 |he curre|nt port |
|00000a40| 28 73 75 63 68 20 61 73 | 20 74 68 65 0d 20 62 75 |(such as| the. bu|
|00000a50| 67 20 28 66 65 61 74 75 | 72 65 3f 29 20 69 6e 20 |g (featu|re?) in |
|00000a60| 6d 61 6e 79 20 64 65 73 | 6b 20 61 63 63 65 73 73 |many des|k access|
|00000a70| 6f 72 69 65 73 20 77 68 | 69 63 68 20 63 68 61 6e |ories wh|ich chan|
|00000a80| 67 65 20 74 68 65 20 70 | 6f 72 74 20 6f 6e 20 4f |ge the p|ort on O|
|00000a90| 70 65 6e 44 65 73 6b 41 | 63 63 29 2e 0d 20 48 6f |penDeskA|cc).. Ho|
|00000aa0| 70 65 66 75 6c 6c 79 2c | 20 74 68 69 73 20 61 6c |pefully,| this al|
|00000ab0| 73 6f 20 6d 61 6b 65 73 | 20 74 68 65 20 72 6f 75 |so makes| the rou|
|00000ac0| 74 69 6e 65 73 20 66 72 | 6f 6d 20 74 68 69 73 20 |tines fr|om this |
|00000ad0| 70 72 6f 67 72 61 6d 20 | 6d 6f 72 65 20 73 65 6c |program |more sel|
|00000ae0| 66 2d 63 6f 6e 74 61 69 | 6e 65 64 2c 0d 20 73 69 |f-contai|ned,. si|
|00000af0| 6e 63 65 20 74 68 65 79 | 20 64 6f 6e 27 74 20 64 |nce they| don't d|
|00000b00| 65 70 65 6e 64 20 6f 6e | 20 74 68 65 20 63 75 72 |epend on| the cur|
|00000b10| 72 65 6e 74 20 70 6f 72 | 74 20 73 65 74 74 69 6e |rent por|t settin|
|00000b20| 67 2e 7d 0d 0d 0d 55 53 | 45 53 0d 09 4d 65 6d 54 |g.}...US|ES..MemT|
|00000b30| 79 70 65 73 2c 20 51 75 | 69 63 6b 44 72 61 77 2c |ypes, Qu|ickDraw,|
|00000b40| 20 4f 53 49 6e 74 66 2c | 20 54 6f 6f 6c 49 6e 74 | OSIntf,| ToolInt|
|00000b50| 66 2c 20 54 72 61 70 73 | 3b 0d 0d 43 4f 4e 53 54 |f, Traps|;..CONST|
|00000b60| 0d 0d 09 7b 31 2e 30 31 | 20 2d 20 63 68 61 6e 67 |...{1.01| - chang|
|00000b70| 65 64 20 63 6f 6e 73 74 | 61 6e 74 73 20 74 6f 20 |ed const|ants to |
|00000b80| 62 65 67 69 6e 20 77 69 | 74 68 20 27 6b 27 20 66 |begin wi|th 'k' f|
|00000b90| 6f 72 20 63 6f 6e 73 69 | 73 74 65 6e 63 79 2c 20 |or consi|stency, |
|00000ba0| 65 78 63 65 70 74 20 66 | 6f 72 20 72 65 73 6f 75 |except f|or resou|
|00000bb0| 72 63 65 20 49 44 73 7d | 0d 09 7b 53 79 73 45 6e |rce IDs}|..{SysEn|
|00000bc0| 76 69 72 6f 6e 73 56 65 | 72 73 69 6f 6e 20 69 73 |vironsVe|rsion is|
|00000bd0| 20 70 61 73 73 65 64 20 | 74 6f 20 53 79 73 45 6e | passed |to SysEn|
|00000be0| 76 69 72 6f 6e 73 20 74 | 6f 20 74 65 6c 6c 20 69 |virons t|o tell i|
|00000bf0| 74 20 77 68 69 63 68 20 | 76 65 72 73 69 6f 6e 20 |t which |version |
|00000c00| 6f 66 20 74 68 65 0d 09 | 20 53 79 73 45 6e 76 52 |of the..| SysEnvR|
|00000c10| 65 63 20 77 65 20 75 6e | 64 65 72 73 74 61 6e 64 |ec we un|derstand|
|00000c20| 2e 7d 0d 09 6b 53 79 73 | 45 6e 76 69 72 6f 6e 73 |.}..kSys|Environs|
|00000c30| 56 65 72 73 69 6f 6e 09 | 09 3d 20 31 3b 0d 0d 09 |Version.|.= 1;...|
|00000c40| 7b 4f 53 45 76 65 6e 74 | 20 69 73 20 74 68 65 20 |{OSEvent| is the |
|00000c50| 65 76 65 6e 74 20 6e 75 | 6d 62 65 72 20 6f 66 20 |event nu|mber of |
|00000c60| 74 68 65 20 73 75 73 70 | 65 6e 64 2f 72 65 73 75 |the susp|end/resu|
|00000c70| 6d 65 20 61 6e 64 20 6d | 6f 75 73 65 2d 6d 6f 76 |me and m|ouse-mov|
|00000c80| 65 64 20 65 76 65 6e 74 | 73 20 73 65 6e 74 0d 09 |ed event|s sent..|
|00000c90| 20 62 79 20 4d 75 6c 74 | 69 46 69 6e 64 65 72 2e | by Mult|iFinder.|
|00000ca0| 20 4f 6e 63 65 20 77 65 | 20 64 65 74 65 72 6d 69 | Once we| determi|
|00000cb0| 6e 65 20 74 68 61 74 20 | 61 6e 20 65 76 65 6e 74 |ne that |an event|
|00000cc0| 20 69 73 20 61 6e 20 6f | 73 45 76 65 6e 74 2c 20 | is an o|sEvent, |
|00000cd0| 77 65 20 6c 6f 6f 6b 20 | 61 74 20 74 68 65 0d 09 |we look |at the..|
|00000ce0| 20 68 69 67 68 20 62 79 | 74 65 20 6f 66 20 74 68 | high by|te of th|
|00000cf0| 65 20 6d 65 73 73 61 67 | 65 20 73 65 6e 74 20 74 |e messag|e sent t|
|00000d00| 6f 20 64 65 74 65 72 6d | 69 6e 65 20 77 68 69 63 |o determ|ine whic|
|00000d10| 68 20 6b 69 6e 64 20 69 | 74 20 69 73 2e 20 54 6f |h kind i|t is. To|
|00000d20| 20 64 69 66 66 65 72 65 | 6e 74 69 61 74 65 0d 09 | differe|ntiate..|
|00000d30| 20 73 75 73 70 65 6e 64 | 20 61 6e 64 20 72 65 73 | suspend| and res|
|00000d40| 75 6d 65 20 65 76 65 6e | 74 73 20 77 65 20 63 68 |ume even|ts we ch|
|00000d50| 65 63 6b 20 74 68 65 20 | 72 65 73 75 6d 65 4d 61 |eck the |resumeMa|
|00000d60| 73 6b 20 62 69 74 2e 7d | 0d 09 6b 4f 53 45 76 65 |sk bit.}|..kOSEve|
|00000d70| 6e 74 09 09 09 09 3d 20 | 61 70 70 34 45 76 74 3b |nt....= |app4Evt;|
|00000d80| 09 7b 65 76 65 6e 74 20 | 75 73 65 64 20 62 79 20 |.{event |used by |
|00000d90| 4d 75 6c 74 69 46 69 6e | 64 65 72 7d 0d 09 6b 53 |MultiFin|der}..kS|
|00000da0| 75 73 70 65 6e 64 52 65 | 73 75 6d 65 4d 65 73 73 |uspendRe|sumeMess|
|00000db0| 61 67 65 09 3d 20 31 3b | 09 09 7b 68 69 67 68 20 |age.= 1;|..{high |
|00000dc0| 62 79 74 65 20 6f 66 20 | 73 75 73 70 65 6e 64 2f |byte of |suspend/|
|00000dd0| 72 65 73 75 6d 65 20 65 | 76 65 6e 74 20 6d 65 73 |resume e|vent mes|
|00000de0| 73 61 67 65 7d 0d 09 6b | 52 65 73 75 6d 65 4d 61 |sage}..k|ResumeMa|
|00000df0| 73 6b 09 09 09 09 3d 20 | 31 3b 09 09 7b 62 69 74 |sk....= |1;..{bit|
|00000e00| 20 6f 66 20 6d 65 73 73 | 61 67 65 20 66 69 65 6c | of mess|age fiel|
|00000e10| 64 20 66 6f 72 20 72 65 | 73 75 6d 65 20 76 73 2e |d for re|sume vs.|
|00000e20| 20 73 75 73 70 65 6e 64 | 7d 0d 0d 09 7b 31 2e 30 | suspend|}...{1.0|
|00000e30| 31 20 2d 20 6b 4d 69 6e | 48 65 61 70 20 2d 20 54 |1 - kMin|Heap - T|
|00000e40| 68 69 73 20 69 73 20 74 | 68 65 20 6d 69 6e 69 6d |his is t|he minim|
|00000e50| 75 6d 20 72 65 73 75 6c | 74 20 66 72 6f 6d 20 74 |um resul|t from t|
|00000e60| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 0d 09 20 65 |he follo|wing.. e|
|00000e70| 71 75 61 74 69 6f 6e 3a | 0d 09 09 09 0d 09 09 09 |quation:|........|
|00000e80| 4f 52 44 28 47 65 74 41 | 70 70 6c 4c 69 6d 69 74 |ORD(GetA|pplLimit|
|00000e90| 29 20 2d 20 4f 52 44 28 | 41 70 70 6c 69 63 5a 6f |) - ORD(|ApplicZo|
|00000ea0| 6e 65 29 0d 09 09 09 0d | 09 20 66 6f 72 20 74 68 |ne).....|. for th|
|00000eb0| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 74 6f |e applic|ation to|
|00000ec0| 20 72 75 6e 2e 20 49 74 | 20 77 69 6c 6c 20 69 6e | run. It| will in|
|00000ed0| 73 75 72 65 20 74 68 61 | 74 20 65 6e 6f 75 67 68 |sure tha|t enough|
|00000ee0| 20 6d 65 6d 6f 72 79 20 | 77 69 6c 6c 0d 09 20 62 | memory |will.. b|
|00000ef0| 65 20 61 72 6f 75 6e 64 | 20 66 6f 72 20 72 65 61 |e around| for rea|
|00000f00| 73 6f 6e 61 62 6c 65 2d | 73 69 7a 65 64 20 73 63 |sonable-|sized sc|
|00000f10| 72 61 70 73 2c 20 46 4b | 45 59 73 2c 20 65 74 63 |raps, FK|EYs, etc|
|00000f20| 2e 20 74 6f 20 65 78 69 | 73 74 20 77 69 74 68 20 |. to exi|st with |
|00000f30| 74 68 65 0d 09 20 61 70 | 70 6c 69 63 61 74 69 6f |the.. ap|plicatio|
|00000f40| 6e 2c 20 61 6e 64 20 73 | 74 69 6c 6c 20 67 69 76 |n, and s|till giv|
|00000f50| 65 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |e the ap|plicatio|
|00000f60| 6e 20 73 6f 6d 65 20 27 | 62 72 65 61 74 68 69 6e |n some '|breathin|
|00000f70| 67 20 72 6f 6f 6d 27 2e | 0d 09 20 54 6f 20 64 65 |g room'.|.. To de|
|00000f80| 72 69 76 65 20 74 68 69 | 73 20 6e 75 6d 62 65 72 |rive thi|s number|
|00000f90| 2c 20 77 65 20 72 61 6e | 20 75 6e 64 65 72 20 61 |, we ran| under a|
|00000fa0| 20 4d 75 6c 74 69 46 69 | 6e 64 65 72 20 70 61 72 | MultiFi|nder par|
|00000fb0| 74 69 74 69 6f 6e 20 74 | 68 61 74 20 77 61 73 0d |tition t|hat was.|
|00000fc0| 09 20 6f 75 72 20 72 65 | 71 75 65 73 74 65 64 20 |. our re|quested |
|00000fd0| 6d 69 6e 69 6d 75 6d 20 | 73 69 7a 65 2c 20 61 73 |minimum |size, as|
|00000fe0| 20 67 69 76 65 6e 20 69 | 6e 20 74 68 65 20 27 53 | given i|n the 'S|
|00000ff0| 49 5a 45 27 20 72 65 73 | 6f 75 72 63 65 2e 7d 0d |IZE' res|ource.}.|
|00001000| 09 20 0d 09 6b 4d 69 6e | 48 65 61 70 09 3d 20 32 |. ..kMin|Heap.= 2|
|00001010| 31 20 2a 20 31 30 32 34 | 3b 0d 09 0d 09 7b 31 2e |1 * 1024|;....{1.|
|00001020| 30 31 20 2d 20 6b 4d 69 | 6e 53 70 61 63 65 20 2d |01 - kMi|nSpace -|
|00001030| 20 54 68 69 73 20 69 73 | 20 74 68 65 20 6d 69 6e | This is| the min|
|00001040| 69 6d 75 6d 20 72 65 73 | 75 6c 74 20 66 72 6f 6d |imum res|ult from|
|00001050| 20 50 75 72 67 65 53 70 | 61 63 65 2c 20 77 68 65 | PurgeSp|ace, whe|
|00001060| 6e 20 63 61 6c 6c 65 64 | 0d 09 20 61 74 20 69 6e |n called|.. at in|
|00001070| 69 74 69 61 6c 69 7a 61 | 74 69 6f 6e 20 74 69 6d |itializa|tion tim|
|00001080| 65 2c 20 66 6f 72 20 74 | 68 65 20 61 70 70 6c 69 |e, for t|he appli|
|00001090| 63 61 74 69 6f 6e 20 74 | 6f 20 72 75 6e 2e 20 54 |cation t|o run. T|
|000010a0| 68 69 73 20 6e 75 6d 62 | 65 72 20 61 63 74 73 0d |his numb|er acts.|
|000010b0| 09 20 61 73 20 61 20 64 | 6f 75 62 6c 65 2d 63 68 |. as a d|ouble-ch|
|000010c0| 65 63 6b 20 74 6f 20 69 | 6e 73 75 72 65 20 74 68 |eck to i|nsure th|
|000010d0| 61 74 20 74 68 65 72 65 | 20 72 65 61 6c 6c 79 20 |at there| really |
|000010e0| 69 73 20 65 6e 6f 75 67 | 68 20 6d 65 6d 6f 72 79 |is enoug|h memory|
|000010f0| 20 66 6f 72 20 74 68 65 | 0d 09 20 61 70 70 6c 69 | for the|.. appli|
|00001100| 63 61 74 69 6f 6e 20 74 | 6f 20 72 75 6e 2c 20 69 |cation t|o run, i|
|00001110| 6e 63 6c 75 64 69 6e 67 | 20 77 68 61 74 20 68 61 |ncluding| what ha|
|00001120| 73 20 62 65 65 6e 20 74 | 61 6b 65 6e 20 75 70 20 |s been t|aken up |
|00001130| 61 6c 72 65 61 64 79 20 | 62 79 0d 09 20 70 72 65 |already |by.. pre|
|00001140| 2d 6c 6f 61 64 65 64 20 | 72 65 73 6f 75 72 63 65 |-loaded |resource|
|00001150| 73 2c 20 74 68 65 20 73 | 63 72 61 70 2c 20 63 6f |s, the s|crap, co|
|00001160| 64 65 2c 20 61 6e 64 20 | 6f 74 68 65 72 20 73 75 |de, and |other su|
|00001170| 6e 64 72 79 20 6d 65 6d | 6f 72 79 20 62 6c 6f 63 |ndry mem|ory bloc|
|00001180| 6b 73 2e 7d 0d 09 20 0d | 09 6b 4d 69 6e 53 70 61 |ks.}.. .|.kMinSpa|
|00001190| 63 65 09 3d 20 38 20 2a | 20 31 30 32 34 3b 0d 09 |ce.= 8 *| 1024;..|
|000011a0| 0d 09 7b 6b 45 78 74 72 | 65 6d 65 4e 65 67 20 61 |..{kExtr|emeNeg a|
|000011b0| 6e 64 20 6b 45 78 74 72 | 65 6d 65 50 6f 73 20 61 |nd kExtr|emePos a|
|000011c0| 72 65 20 75 73 65 64 20 | 74 6f 20 73 65 74 20 75 |re used |to set u|
|000011d0| 70 20 77 69 64 65 20 6f | 70 65 6e 20 72 65 63 74 |p wide o|pen rect|
|000011e0| 61 6e 67 6c 65 73 20 61 | 6e 64 20 72 65 67 69 6f |angles a|nd regio|
|000011f0| 6e 73 2e 7d 0d 09 6b 45 | 78 74 72 65 6d 65 4e 65 |ns.}..kE|xtremeNe|
|00001200| 67 09 3d 20 2d 33 32 37 | 36 38 3b 0d 09 6b 45 78 |g.= -327|68;..kEx|
|00001210| 74 72 65 6d 65 50 6f 73 | 09 3d 20 33 32 37 36 37 |tremePos|.= 32767|
|00001220| 20 2d 20 31 3b 09 09 09 | 7b 72 65 71 75 69 72 65 | - 1;...|{require|
|00001230| 64 20 66 6f 72 20 6f 6c | 64 20 72 65 67 69 6f 6e |d for ol|d region|
|00001240| 20 62 75 67 7d 0d 09 0d | 09 7b 54 68 65 20 66 6f | bug}...|.{The fo|
|00001250| 6c 6c 6f 77 69 6e 67 20 | 63 6f 6e 73 74 61 6e 74 |llowing |constant|
|00001260| 73 20 61 72 65 20 61 6c | 6c 20 72 65 73 6f 75 72 |s are al|l resour|
|00001270| 63 65 20 49 44 73 2c 20 | 63 6f 72 72 65 73 70 6f |ce IDs, |correspo|
|00001280| 6e 64 69 6e 67 20 74 6f | 20 72 65 73 6f 75 72 63 |nding to| resourc|
|00001290| 65 73 20 69 6e 20 53 61 | 6d 70 6c 65 2e 72 2e 7d |es in Sa|mple.r.}|
|000012a0| 0d 09 72 4d 65 6e 75 42 | 61 72 09 3d 20 31 32 38 |..rMenuB|ar.= 128|
|000012b0| 3b 09 09 09 09 09 7b 61 | 70 70 6c 69 63 61 74 69 |;.....{a|pplicati|
|000012c0| 6f 6e 27 73 20 6d 65 6e | 75 20 62 61 72 7d 0d 09 |on's men|u bar}..|
|000012d0| 72 41 62 6f 75 74 41 6c | 65 72 74 09 3d 20 31 32 |rAboutAl|ert.= 12|
|000012e0| 38 3b 09 09 09 09 09 7b | 61 62 6f 75 74 20 61 6c |8;.....{|about al|
|000012f0| 65 72 74 7d 0d 09 72 55 | 73 65 72 41 6c 65 72 74 |ert}..rU|serAlert|
|00001300| 09 3d 20 31 32 39 3b 09 | 09 09 09 09 7b 65 72 72 |.= 129;.|....{err|
|00001310| 6f 72 20 75 73 65 72 20 | 61 6c 65 72 74 7d 0d 09 |or user |alert}..|
|00001320| 72 57 69 6e 64 6f 77 09 | 09 3d 20 31 32 38 3b 09 |rWindow.|.= 128;.|
|00001330| 09 09 09 09 7b 61 70 70 | 6c 69 63 61 74 69 6f 6e |....{app|lication|
|00001340| 27 73 20 77 69 6e 64 6f | 77 7d 0d 09 72 53 74 6f |'s windo|w}..rSto|
|00001350| 70 52 65 63 74 09 3d 20 | 31 32 38 3b 09 09 09 09 |pRect.= |128;....|
|00001360| 09 7b 72 65 63 74 61 6e | 67 6c 65 20 66 6f 72 20 |.{rectan|gle for |
|00001370| 53 74 6f 70 20 6c 69 67 | 68 74 7d 0d 09 72 47 6f |Stop lig|ht}..rGo|
|00001380| 52 65 63 74 09 09 3d 20 | 31 32 39 3b 09 09 09 09 |Rect..= |129;....|
|00001390| 09 7b 72 65 63 74 61 6e | 67 6c 65 20 66 6f 72 20 |.{rectan|gle for |
|000013a0| 47 6f 20 6c 69 67 68 74 | 7d 0d 0d 09 7b 54 68 65 |Go light|}...{The|
|000013b0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 63 6f 6e 73 74 | followi|ng const|
|000013c0| 61 6e 74 73 20 61 72 65 | 20 75 73 65 64 20 74 6f |ants are| used to|
|000013d0| 20 69 64 65 6e 74 69 66 | 79 20 6d 65 6e 75 73 20 | identif|y menus |
|000013e0| 61 6e 64 20 74 68 65 69 | 72 20 69 74 65 6d 73 2e |and thei|r items.|
|000013f0| 20 54 68 65 20 6d 65 6e | 75 20 49 44 73 0d 09 20 | The men|u IDs.. |
|00001400| 68 61 76 65 20 61 6e 20 | 22 6d 22 20 70 72 65 66 |have an |"m" pref|
|00001410| 69 78 20 61 6e 64 20 74 | 68 65 20 69 74 65 6d 20 |ix and t|he item |
|00001420| 6e 75 6d 62 65 72 73 20 | 77 69 74 68 69 6e 20 65 |numbers |within e|
|00001430| 61 63 68 20 6d 65 6e 75 | 20 68 61 76 65 20 61 6e |ach menu| have an|
|00001440| 20 22 69 22 20 70 72 65 | 66 69 78 2e 7d 0d 09 6d | "i" pre|fix.}..m|
|00001450| 41 70 70 6c 65 09 09 3d | 20 31 32 38 3b 09 09 09 |Apple..=| 128;...|
|00001460| 09 09 7b 41 70 70 6c 65 | 20 6d 65 6e 75 7d 0d 09 |..{Apple| menu}..|
|00001470| 69 41 62 6f 75 74 09 09 | 3d 20 31 3b 0d 0d 09 6d |iAbout..|= 1;...m|
|00001480| 46 69 6c 65 09 09 3d 20 | 31 32 39 3b 09 09 09 09 |File..= |129;....|
|00001490| 09 7b 46 69 6c 65 20 6d | 65 6e 75 7d 0d 09 69 4e |.{File m|enu}..iN|
|000014a0| 65 77 09 09 3d 20 31 3b | 0d 09 69 43 6c 6f 73 65 |ew..= 1;|..iClose|
|000014b0| 09 09 3d 20 34 3b 0d 09 | 69 51 75 69 74 09 09 3d |..= 4;..|iQuit..=|
|000014c0| 20 31 32 3b 0d 0d 09 6d | 45 64 69 74 09 09 3d 20 | 12;...m|Edit..= |
|000014d0| 31 33 30 3b 09 09 09 09 | 09 7b 45 64 69 74 20 6d |130;....|.{Edit m|
|000014e0| 65 6e 75 7d 0d 09 69 55 | 6e 64 6f 09 09 3d 20 31 |enu}..iU|ndo..= 1|
|000014f0| 3b 0d 09 69 43 75 74 09 | 09 3d 20 33 3b 0d 09 69 |;..iCut.|.= 3;..i|
|00001500| 43 6f 70 79 09 09 3d 20 | 34 3b 0d 09 69 50 61 73 |Copy..= |4;..iPas|
|00001510| 74 65 09 09 3d 20 35 3b | 0d 09 69 43 6c 65 61 72 |te..= 5;|..iClear|
|00001520| 09 09 3d 20 36 3b 0d 0d | 09 6d 4c 69 67 68 74 09 |..= 6;..|.mLight.|
|00001530| 09 3d 20 31 33 31 3b 09 | 09 09 09 09 7b 4c 69 67 |.= 131;.|....{Lig|
|00001540| 68 74 20 6d 65 6e 75 7d | 0d 09 69 53 74 6f 70 09 |ht menu}|..iStop.|
|00001550| 09 3d 20 31 3b 0d 09 69 | 47 6f 09 09 09 3d 20 32 |.= 1;..i|Go...= 2|
|00001560| 3b 0d 0d 0d 56 41 52 0d | 09 7b 54 68 65 20 22 67 |;...VAR.|.{The "g|
|00001570| 22 20 70 72 65 66 69 78 | 20 69 73 20 75 73 65 64 |" prefix| is used|
|00001580| 20 74 6f 20 65 6d 70 68 | 61 73 69 7a 65 20 74 68 | to emph|asize th|
|00001590| 61 74 20 61 20 76 61 72 | 69 61 62 6c 65 20 69 73 |at a var|iable is|
|000015a0| 20 67 6c 6f 62 61 6c 2e | 7d 0d 0d 09 7b 47 4d 61 | global.|}...{GMa|
|000015b0| 63 20 69 73 20 75 73 65 | 64 20 74 6f 20 68 6f 6c |c is use|d to hol|
|000015c0| 64 20 74 68 65 20 72 65 | 73 75 6c 74 20 6f 66 20 |d the re|sult of |
|000015d0| 61 20 53 79 73 45 6e 76 | 69 72 6f 6e 73 20 63 61 |a SysEnv|irons ca|
|000015e0| 6c 6c 2e 20 54 68 69 73 | 20 6d 61 6b 65 73 0d 09 |ll. This| makes..|
|000015f0| 20 69 74 20 63 6f 6e 76 | 65 6e 69 65 6e 74 20 66 | it conv|enient f|
|00001600| 6f 72 20 61 6e 79 20 72 | 6f 75 74 69 6e 65 20 74 |or any r|outine t|
|00001610| 6f 20 63 68 65 63 6b 20 | 74 68 65 20 65 6e 76 69 |o check |the envi|
|00001620| 72 6f 6e 6d 65 6e 74 2e | 20 49 74 20 69 73 0d 09 |ronment.| It is..|
|00001630| 20 67 6c 6f 62 61 6c 20 | 69 6e 66 6f 72 6d 61 74 | global |informat|
|00001640| 69 6f 6e 2c 20 61 6e 79 | 77 61 79 2e 7d 0d 09 67 |ion, any|way.}..g|
|00001650| 4d 61 63 09 09 09 09 3a | 20 53 79 73 45 6e 76 52 |Mac....:| SysEnvR|
|00001660| 65 63 3b 09 7b 73 65 74 | 20 75 70 20 62 79 20 49 |ec;.{set| up by I|
|00001670| 6e 69 74 69 61 6c 69 7a | 65 7d 0d 0d 09 7b 47 48 |nitializ|e}...{GH|
|00001680| 61 73 57 61 69 74 4e 65 | 78 74 45 76 65 6e 74 20 |asWaitNe|xtEvent |
|00001690| 69 73 20 73 65 74 20 61 | 74 20 73 74 61 72 74 75 |is set a|t startu|
|000016a0| 70 2c 20 61 6e 64 20 74 | 65 6c 6c 73 20 77 68 65 |p, and t|ells whe|
|000016b0| 74 68 65 72 20 74 68 65 | 20 57 61 69 74 4e 65 78 |ther the| WaitNex|
|000016c0| 74 45 76 65 6e 74 0d 09 | 20 74 72 61 70 20 69 73 |tEvent..| trap is|
|000016d0| 20 61 76 61 69 6c 61 62 | 6c 65 2e 20 49 66 20 69 | availab|le. If i|
|000016e0| 74 20 69 73 20 66 61 6c | 73 65 2c 20 77 65 20 6b |t is fal|se, we k|
|000016f0| 6e 6f 77 20 74 68 61 74 | 20 77 65 20 6d 75 73 74 |now that| we must|
|00001700| 20 63 61 6c 6c 20 47 65 | 74 4e 65 78 74 45 76 65 | call Ge|tNextEve|
|00001710| 6e 74 2e 7d 0d 09 67 48 | 61 73 57 61 69 74 4e 65 |nt.}..gH|asWaitNe|
|00001720| 78 74 45 76 65 6e 74 09 | 3a 20 42 4f 4f 4c 45 41 |xtEvent.|: BOOLEA|
|00001730| 4e 3b 09 09 7b 73 65 74 | 20 75 70 20 62 79 20 49 |N;..{set| up by I|
|00001740| 6e 69 74 69 61 6c 69 7a | 65 7d 0d 0d 09 7b 47 49 |nitializ|e}...{GI|
|00001750| 6e 42 61 63 6b 67 72 6f | 75 6e 64 20 69 73 20 6d |nBackgro|und is m|
|00001760| 61 69 6e 74 61 69 6e 65 | 64 20 62 79 20 6f 75 72 |aintaine|d by our|
|00001770| 20 6f 73 45 76 65 6e 74 | 20 68 61 6e 64 6c 69 6e | osEvent| handlin|
|00001780| 67 20 72 6f 75 74 69 6e | 65 73 2e 20 41 6e 79 20 |g routin|es. Any |
|00001790| 70 61 72 74 20 6f 66 0d | 09 20 74 68 65 20 70 72 |part of.|. the pr|
|000017a0| 6f 67 72 61 6d 20 63 61 | 6e 20 63 68 65 63 6b 20 |ogram ca|n check |
|000017b0| 69 74 20 74 6f 20 66 69 | 6e 64 20 6f 75 74 20 69 |it to fi|nd out i|
|000017c0| 66 20 69 74 20 69 73 20 | 63 75 72 72 65 6e 74 6c |f it is |currentl|
|000017d0| 79 20 69 6e 20 74 68 65 | 20 62 61 63 6b 67 72 6f |y in the| backgro|
|000017e0| 75 6e 64 2e 7d 0d 09 67 | 49 6e 42 61 63 6b 67 72 |und.}..g|InBackgr|
|000017f0| 6f 75 6e 64 09 09 3a 20 | 42 4f 4f 4c 45 41 4e 3b |ound..: |BOOLEAN;|
|00001800| 09 09 7b 6d 61 69 6e 74 | 61 69 6e 65 64 20 62 79 |..{maint|ained by|
|00001810| 20 49 6e 69 74 69 61 6c | 69 7a 65 20 61 6e 64 20 | Initial|ize and |
|00001820| 44 6f 45 76 65 6e 74 7d | 0d 0d 0d 09 7b 54 68 65 |DoEvent}|....{The|
|00001830| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 67 6c 6f 62 61 | followi|ng globa|
|00001840| 6c 73 20 61 72 65 20 74 | 68 65 20 73 74 61 74 65 |ls are t|he state|
|00001850| 20 6f 66 20 74 68 65 20 | 77 69 6e 64 6f 77 2e 20 | of the |window. |
|00001860| 49 66 20 77 65 20 73 75 | 70 70 6f 72 74 65 64 20 |If we su|pported |
|00001870| 6d 6f 72 65 20 74 68 61 | 6e 0d 09 20 6f 6e 65 20 |more tha|n.. one |
|00001880| 77 69 6e 64 6f 77 2c 20 | 74 68 65 79 20 77 6f 75 |window, |they wou|
|00001890| 6c 64 20 62 65 20 61 74 | 74 61 74 63 68 65 64 20 |ld be at|tatched |
|000018a0| 74 6f 20 65 61 63 68 20 | 64 6f 63 75 6d 65 6e 74 |to each |document|
|000018b0| 2c 20 72 61 74 68 65 72 | 20 74 68 61 6e 20 67 6c |, rather| than gl|
|000018c0| 6f 62 61 6c 73 2e 7d 0d | 0d 09 7b 47 53 74 6f 70 |obals.}.|..{GStop|
|000018d0| 70 65 64 20 74 65 6c 6c | 73 20 77 68 65 74 68 65 |ped tell|s whethe|
|000018e0| 72 20 74 68 65 20 73 74 | 6f 70 20 6c 69 67 68 74 |r the st|op light|
|000018f0| 20 69 73 20 63 75 72 72 | 65 6e 74 6c 79 20 6f 6e | is curr|ently on|
|00001900| 20 73 74 6f 70 20 6f 72 | 20 67 6f 2e 7d 0d 09 67 | stop or| go.}..g|
|00001910| 53 74 6f 70 70 65 64 09 | 09 09 3a 20 42 4f 4f 4c |Stopped.|..: BOOL|
|00001920| 45 41 4e 3b 09 09 7b 6d | 61 69 6e 74 61 69 6e 65 |EAN;..{m|aintaine|
|00001930| 64 20 62 79 20 49 6e 69 | 74 69 61 6c 69 7a 65 20 |d by Ini|tialize |
|00001940| 61 6e 64 20 53 65 74 4c | 69 67 68 74 7d 0d 0d 09 |and SetL|ight}...|
|00001950| 7b 47 53 74 6f 70 52 65 | 63 74 20 61 6e 64 20 67 |{GStopRe|ct and g|
|00001960| 47 6f 52 65 63 74 20 61 | 72 65 20 74 68 65 20 72 |GoRect a|re the r|
|00001970| 65 63 74 61 6e 67 6c 65 | 73 20 6f 66 20 74 68 65 |ectangle|s of the|
|00001980| 20 74 77 6f 20 73 74 6f | 70 20 6c 69 67 68 74 73 | two sto|p lights|
|00001990| 20 69 6e 20 74 68 65 20 | 77 69 6e 64 6f 77 2e 7d | in the |window.}|
|000019a0| 0d 09 67 53 74 6f 70 52 | 65 63 74 09 09 09 3a 20 |..gStopR|ect...: |
|000019b0| 52 65 63 74 3b 09 09 09 | 7b 73 65 74 20 75 70 20 |Rect;...|{set up |
|000019c0| 62 79 20 49 6e 69 74 69 | 61 6c 69 7a 65 7d 0d 09 |by Initi|alize}..|
|000019d0| 67 47 6f 52 65 63 74 09 | 09 09 09 3a 20 52 65 63 |gGoRect.|...: Rec|
|000019e0| 74 3b 09 09 09 7b 73 65 | 74 20 75 70 20 62 79 20 |t;...{se|t up by |
|000019f0| 49 6e 69 74 69 61 6c 69 | 7a 65 7d 0d 0d 0d 7b 24 |Initiali|ze}...{$|
|00001a00| 53 20 49 6e 69 74 69 61 | 6c 69 7a 65 7d 0d 46 55 |S Initia|lize}.FU|
|00001a10| 4e 43 54 49 4f 4e 20 54 | 72 61 70 41 76 61 69 6c |NCTION T|rapAvail|
|00001a20| 61 62 6c 65 28 74 4e 75 | 6d 62 65 72 3a 20 49 4e |able(tNu|mber: IN|
|00001a30| 54 45 47 45 52 3b 20 74 | 54 79 70 65 3a 20 54 72 |TEGER; t|Type: Tr|
|00001a40| 61 70 54 79 70 65 29 3a | 20 42 4f 4f 4c 45 41 4e |apType):| BOOLEAN|
|00001a50| 3b 0d 0d 7b 43 68 65 63 | 6b 20 74 6f 20 73 65 65 |;..{Chec|k to see|
|00001a60| 20 69 66 20 61 20 67 69 | 76 65 6e 20 74 72 61 70 | if a gi|ven trap|
|00001a70| 20 69 73 20 69 6d 70 6c | 65 6d 65 6e 74 65 64 2e | is impl|emented.|
|00001a80| 20 54 68 69 73 20 69 73 | 20 6f 6e 6c 79 20 75 73 | This is| only us|
|00001a90| 65 64 20 62 79 20 74 68 | 65 0d 20 49 6e 69 74 69 |ed by th|e. Initi|
|00001aa0| 61 6c 69 7a 65 20 72 6f | 75 74 69 6e 65 20 69 6e |alize ro|utine in|
|00001ab0| 20 74 68 69 73 20 70 72 | 6f 67 72 61 6d 2c 20 73 | this pr|ogram, s|
|00001ac0| 6f 20 77 65 20 70 75 74 | 20 69 74 20 69 6e 20 74 |o we put| it in t|
|00001ad0| 68 65 20 49 6e 69 74 69 | 61 6c 69 7a 65 20 73 65 |he Initi|alize se|
|00001ae0| 67 6d 65 6e 74 2e 0d 20 | 54 68 65 20 72 65 63 6f |gment.. |The reco|
|00001af0| 6d 6d 65 6e 64 65 64 20 | 61 70 70 72 6f 61 63 68 |mmended |approach|
|00001b00| 20 74 6f 20 73 65 65 20 | 69 66 20 61 20 74 72 61 | to see |if a tra|
|00001b10| 70 20 69 73 20 69 6d 70 | 6c 65 6d 65 6e 74 65 64 |p is imp|lemented|
|00001b20| 20 69 73 20 74 6f 20 73 | 65 65 20 69 66 0d 20 74 | is to s|ee if. t|
|00001b30| 68 65 20 61 64 64 72 65 | 73 73 20 6f 66 20 74 68 |he addre|ss of th|
|00001b40| 65 20 74 72 61 70 20 72 | 6f 75 74 69 6e 65 20 69 |e trap r|outine i|
|00001b50| 73 20 74 68 65 20 73 61 | 6d 65 20 61 73 20 74 68 |s the sa|me as th|
|00001b60| 65 20 61 64 64 72 65 73 | 73 20 6f 66 20 74 68 65 |e addres|s of the|
|00001b70| 0d 20 55 6e 69 6d 70 6c | 65 6d 65 6e 74 65 64 20 |. Unimpl|emented |
|00001b80| 74 72 61 70 2e 7d 0d 0d | 42 45 47 49 4e 0d 09 7b |trap.}..|BEGIN..{|
|00001b90| 43 68 65 63 6b 20 61 6e | 64 20 73 65 65 20 69 66 |Check an|d see if|
|00001ba0| 20 74 68 65 20 74 72 61 | 70 20 65 78 69 73 74 73 | the tra|p exists|
|00001bb0| 2e 20 4f 6e 20 36 34 4b | 20 52 4f 4d 20 6d 61 63 |. On 64K| ROM mac|
|00001bc0| 68 69 6e 65 73 2c 20 74 | 54 79 70 65 20 77 69 6c |hines, t|Type wil|
|00001bd0| 6c 20 62 65 20 69 67 6e | 6f 72 65 64 2e 7d 0d 0d |l be ign|ored.}..|
|00001be0| 09 54 72 61 70 41 76 61 | 69 6c 61 62 6c 65 20 3a |.TrapAva|ilable :|
|00001bf0| 3d 20 4e 47 65 74 54 72 | 61 70 41 64 64 72 65 73 |= NGetTr|apAddres|
|00001c00| 73 28 74 4e 75 6d 62 65 | 72 2c 20 74 54 79 70 65 |s(tNumbe|r, tType|
|00001c10| 29 20 3c 3e 20 47 65 74 | 54 72 61 70 41 64 64 72 |) <> Get|TrapAddr|
|00001c20| 65 73 73 28 5f 55 6e 69 | 6d 70 6c 65 6d 65 6e 74 |ess(_Uni|mplement|
|00001c30| 65 64 29 3b 0d 45 4e 44 | 3b 20 7b 54 72 61 70 41 |ed);.END|; {TrapA|
|00001c40| 76 61 69 6c 61 62 6c 65 | 7d 0d 0d 0d 7b 24 53 20 |vailable|}...{$S |
|00001c50| 4d 61 69 6e 7d 0d 46 55 | 4e 43 54 49 4f 4e 20 49 |Main}.FU|NCTION I|
|00001c60| 73 44 41 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |sDAWindo|w(window|
|00001c70| 3a 20 57 69 6e 64 6f 77 | 50 74 72 29 3a 20 42 4f |: Window|Ptr): BO|
|00001c80| 4f 4c 45 41 4e 3b 0d 0d | 7b 43 68 65 63 6b 20 69 |OLEAN;..|{Check i|
|00001c90| 66 20 61 20 77 69 6e 64 | 6f 77 20 62 65 6c 6f 6e |f a wind|ow belon|
|00001ca0| 67 73 20 74 6f 20 61 20 | 64 65 73 6b 20 61 63 63 |gs to a |desk acc|
|00001cb0| 65 73 73 6f 72 79 2e 7d | 0d 0d 42 45 47 49 4e 0d |essory.}|..BEGIN.|
|00001cc0| 09 49 46 20 77 69 6e 64 | 6f 77 20 3d 20 4e 49 4c |.IF wind|ow = NIL|
|00001cd0| 20 54 48 45 4e 0d 09 09 | 49 73 44 41 57 69 6e 64 | THEN...|IsDAWind|
|00001ce0| 6f 77 20 3a 3d 20 46 41 | 4c 53 45 0d 09 45 4c 53 |ow := FA|LSE..ELS|
|00001cf0| 45 09 7b 44 41 20 77 69 | 6e 64 6f 77 73 20 68 61 |E.{DA wi|ndows ha|
|00001d00| 76 65 20 6e 65 67 61 74 | 69 76 65 20 77 69 6e 64 |ve negat|ive wind|
|00001d10| 6f 77 4b 69 6e 64 73 7d | 0d 09 09 49 73 44 41 57 |owKinds}|...IsDAW|
|00001d20| 69 6e 64 6f 77 20 3a 3d | 20 57 69 6e 64 6f 77 50 |indow :=| WindowP|
|00001d30| 65 65 6b 28 77 69 6e 64 | 6f 77 29 5e 2e 77 69 6e |eek(wind|ow)^.win|
|00001d40| 64 6f 77 4b 69 6e 64 20 | 3c 20 30 3b 0d 45 4e 44 |dowKind |< 0;.END|
|00001d50| 3b 20 7b 49 73 44 41 57 | 69 6e 64 6f 77 7d 0d 0d |; {IsDAW|indow}..|
|00001d60| 0d 7b 24 53 20 4d 61 69 | 6e 7d 0d 46 55 4e 43 54 |.{$S Mai|n}.FUNCT|
|00001d70| 49 4f 4e 20 49 73 41 70 | 70 57 69 6e 64 6f 77 28 |ION IsAp|pWindow(|
|00001d80| 77 69 6e 64 6f 77 3a 20 | 57 69 6e 64 6f 77 50 74 |window: |WindowPt|
|00001d90| 72 29 3a 20 42 4f 4f 4c | 45 41 4e 3b 0d 0d 7b 43 |r): BOOL|EAN;..{C|
|00001da0| 68 65 63 6b 20 74 6f 20 | 73 65 65 20 69 66 20 61 |heck to |see if a|
|00001db0| 20 77 69 6e 64 6f 77 20 | 62 65 6c 6f 6e 67 73 20 | window |belongs |
|00001dc0| 74 6f 20 74 68 65 20 61 | 70 70 6c 69 63 61 74 69 |to the a|pplicati|
|00001dd0| 6f 6e 2e 20 49 66 20 74 | 68 65 20 77 69 6e 64 6f |on. If t|he windo|
|00001de0| 77 20 70 6f 69 6e 74 65 | 72 0d 20 70 61 73 73 65 |w pointe|r. passe|
|00001df0| 64 20 77 61 73 20 4e 49 | 4c 2c 20 74 68 65 6e 20 |d was NI|L, then |
|00001e00| 69 74 20 63 6f 75 6c 64 | 20 6e 6f 74 20 62 65 20 |it could| not be |
|00001e10| 61 6e 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 77 |an appli|cation w|
|00001e20| 69 6e 64 6f 77 2e 20 57 | 69 6e 64 6f 77 4b 69 6e |indow. W|indowKin|
|00001e30| 64 73 0d 20 74 68 61 74 | 20 61 72 65 20 6e 65 67 |ds. that| are neg|
|00001e40| 61 74 69 76 65 20 62 65 | 6c 6f 6e 67 20 74 6f 20 |ative be|long to |
|00001e50| 74 68 65 20 73 79 73 74 | 65 6d 20 61 6e 64 20 77 |the syst|em and w|
|00001e60| 69 6e 64 6f 77 4b 69 6e | 64 73 20 6c 65 73 73 20 |indowKin|ds less |
|00001e70| 74 68 61 6e 20 75 73 65 | 72 4b 69 6e 64 0d 20 61 |than use|rKind. a|
|00001e80| 72 65 20 72 65 73 65 72 | 76 65 64 20 62 79 20 41 |re reser|ved by A|
|00001e90| 70 70 6c 65 20 65 78 63 | 65 70 74 20 66 6f 72 20 |pple exc|ept for |
|00001ea0| 77 69 6e 64 6f 77 4b 69 | 6e 64 73 20 65 71 75 61 |windowKi|nds equa|
|00001eb0| 6c 20 74 6f 20 64 69 61 | 6c 6f 67 4b 69 6e 64 2c |l to dia|logKind,|
|00001ec0| 20 77 68 69 63 68 0d 20 | 6d 65 61 6e 20 69 74 20 | which. |mean it |
|00001ed0| 69 73 20 61 20 64 69 61 | 6c 6f 67 2e 7d 0d 0d 42 |is a dia|log.}..B|
|00001ee0| 45 47 49 4e 0d 09 49 46 | 20 77 69 6e 64 6f 77 20 |EGIN..IF| window |
|00001ef0| 3d 20 4e 49 4c 20 54 48 | 45 4e 0d 09 09 49 73 41 |= NIL TH|EN...IsA|
|00001f00| 70 70 57 69 6e 64 6f 77 | 20 3a 3d 20 46 41 4c 53 |ppWindow| := FALS|
|00001f10| 45 0d 09 45 4c 53 45 09 | 7b 61 70 70 6c 69 63 61 |E..ELSE.|{applica|
|00001f20| 74 69 6f 6e 20 77 69 6e | 64 6f 77 73 20 68 61 76 |tion win|dows hav|
|00001f30| 65 20 77 69 6e 64 6f 77 | 4b 69 6e 64 73 20 3e 3d |e window|Kinds >=|
|00001f40| 20 75 73 65 72 4b 69 6e | 64 20 28 38 29 20 6f 72 | userKin|d (8) or|
|00001f50| 20 64 69 61 6c 6f 67 4b | 69 6e 64 20 28 32 29 7d | dialogK|ind (2)}|
|00001f60| 0d 09 09 57 49 54 48 20 | 57 69 6e 64 6f 77 50 65 |...WITH |WindowPe|
|00001f70| 65 6b 28 77 69 6e 64 6f | 77 29 5e 20 44 4f 0d 09 |ek(windo|w)^ DO..|
|00001f80| 09 09 49 73 41 70 70 57 | 69 6e 64 6f 77 20 3a 3d |..IsAppW|indow :=|
|00001f90| 20 28 77 69 6e 64 6f 77 | 4b 69 6e 64 20 3e 3d 20 | (window|Kind >= |
|00001fa0| 75 73 65 72 4b 69 6e 64 | 29 20 7c 20 28 77 69 6e |userKind|) | (win|
|00001fb0| 64 6f 77 4b 69 6e 64 20 | 3d 20 64 69 61 6c 6f 67 |dowKind |= dialog|
|00001fc0| 4b 69 6e 64 29 3b 0d 45 | 4e 44 3b 20 7b 49 73 41 |Kind);.E|ND; {IsA|
|00001fd0| 70 70 57 69 6e 64 6f 77 | 7d 0d 0d 0d 7b 24 53 20 |ppWindow|}...{$S |
|00001fe0| 4d 61 69 6e 7d 0d 50 52 | 4f 43 45 44 55 52 45 20 |Main}.PR|OCEDURE |
|00001ff0| 41 6c 65 72 74 55 73 65 | 72 3b 0d 0d 7b 44 69 73 |AlertUse|r;..{Dis|
|00002000| 70 6c 61 79 20 61 6e 20 | 61 6c 65 72 74 20 74 68 |play an |alert th|
|00002010| 61 74 20 74 65 6c 6c 73 | 20 74 68 65 20 75 73 65 |at tells| the use|
|00002020| 72 20 61 6e 20 65 72 72 | 6f 72 20 6f 63 63 75 72 |r an err|or occur|
|00002030| 72 65 64 2c 20 74 68 65 | 6e 20 65 78 69 74 20 74 |red, the|n exit t|
|00002040| 68 65 20 70 72 6f 67 72 | 61 6d 2e 0d 20 54 68 69 |he progr|am.. Thi|
|00002050| 73 20 72 6f 75 74 69 6e | 65 20 69 73 20 75 73 65 |s routin|e is use|
|00002060| 64 20 61 73 20 61 6e 20 | 75 6c 74 69 6d 61 74 65 |d as an |ultimate|
|00002070| 20 62 61 69 6c 2d 6f 75 | 74 20 66 6f 72 20 73 65 | bail-ou|t for se|
|00002080| 72 69 6f 75 73 20 65 72 | 72 6f 72 73 20 74 68 61 |rious er|rors tha|
|00002090| 74 20 70 72 6f 68 69 62 | 69 74 0d 20 74 68 65 20 |t prohib|it. the |
|000020a0| 63 6f 6e 74 69 6e 75 61 | 74 69 6f 6e 20 6f 66 20 |continua|tion of |
|000020b0| 74 68 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2e |the appl|ication.|
|000020c0| 20 45 72 72 6f 72 73 20 | 74 68 61 74 20 64 6f 20 | Errors |that do |
|000020d0| 6e 6f 74 20 72 65 71 75 | 69 72 65 20 74 68 65 20 |not requ|ire the |
|000020e0| 74 65 72 6d 69 6e 61 74 | 69 6f 6e 0d 20 6f 66 20 |terminat|ion. of |
|000020f0| 74 68 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |the appl|ication |
|00002100| 73 68 6f 75 6c 64 20 62 | 65 20 68 61 6e 64 6c 65 |should b|e handle|
|00002110| 64 20 69 6e 20 61 20 64 | 69 66 66 65 72 65 6e 74 |d in a d|ifferent|
|00002120| 20 6d 61 6e 6e 65 72 2e | 20 45 72 72 6f 72 20 63 | manner.| Error c|
|00002130| 68 65 63 6b 69 6e 67 20 | 61 6e 64 0d 20 72 65 70 |hecking |and. rep|
|00002140| 6f 72 74 69 6e 67 20 68 | 61 73 20 61 20 70 6c 61 |orting h|as a pla|
|00002150| 63 65 20 65 76 65 6e 20 | 69 6e 20 74 68 65 20 73 |ce even |in the s|
|00002160| 69 6d 70 6c 65 73 74 20 | 61 70 70 6c 69 63 61 74 |implest |applicat|
|00002170| 69 6f 6e 2e 20 46 6f 72 | 20 73 69 6d 70 6c 69 63 |ion. For| simplic|
|00002180| 69 74 79 2c 20 74 68 65 | 20 61 6c 65 72 74 0d 20 |ity, the| alert. |
|00002190| 64 69 73 70 6c 61 79 65 | 64 20 68 65 72 65 20 6f |displaye|d here o|
|000021a0| 6e 6c 79 20 73 61 79 73 | 20 74 68 61 74 20 61 6e |nly says| that an|
|000021b0| 20 65 72 72 6f 72 20 6f | 63 63 75 72 72 65 64 2c | error o|ccurred,|
|000021c0| 20 62 75 74 20 6e 6f 74 | 20 77 68 61 74 20 69 74 | but not| what it|
|000021d0| 20 77 61 73 2e 20 54 68 | 65 72 65 20 61 72 65 0d | was. Th|ere are.|
|000021e0| 20 76 61 72 69 6f 75 73 | 20 6d 65 74 68 6f 64 73 | various| methods|
|000021f0| 20 61 76 61 69 6c 61 62 | 6c 65 20 66 6f 72 20 62 | availab|le for b|
|00002200| 65 69 6e 67 20 6d 6f 72 | 65 20 73 70 65 63 69 66 |eing mor|e specif|
|00002210| 69 63 2e 7d 0d 20 0d 56 | 41 52 0d 09 69 74 65 6d |ic.}. .V|AR..item|
|00002220| 48 69 74 09 3a 20 49 4e | 54 45 47 45 52 3b 0d 42 |Hit.: IN|TEGER;.B|
|00002230| 45 47 49 4e 0d 09 53 65 | 74 43 75 72 73 6f 72 28 |EGIN..Se|tCursor(|
|00002240| 61 72 72 6f 77 29 3b 0d | 09 69 74 65 6d 48 69 74 |arrow);.|.itemHit|
|00002250| 20 3a 3d 20 41 6c 65 72 | 74 28 72 55 73 65 72 41 | := Aler|t(rUserA|
|00002260| 6c 65 72 74 2c 20 4e 49 | 4c 29 3b 0d 09 45 78 69 |lert, NI|L);..Exi|
|00002270| 74 54 6f 53 68 65 6c 6c | 3b 0d 45 4e 44 3b 20 7b |tToShell|;.END; {|
|00002280| 41 6c 65 72 74 55 73 65 | 72 7d 0d 0d 0d 7b 24 53 |AlertUse|r}...{$S|
|00002290| 20 4d 61 69 6e 7d 0d 46 | 55 4e 43 54 49 4f 4e 20 | Main}.F|UNCTION |
|000022a0| 44 6f 43 6c 6f 73 65 57 | 69 6e 64 6f 77 28 77 69 |DoCloseW|indow(wi|
|000022b0| 6e 64 6f 77 3a 20 57 69 | 6e 64 6f 77 50 74 72 29 |ndow: Wi|ndowPtr)|
|000022c0| 20 3a 20 42 4f 4f 4c 45 | 41 4e 3b 0d 0d 7b 43 6c | : BOOLE|AN;..{Cl|
|000022d0| 6f 73 65 20 61 20 77 69 | 6e 64 6f 77 2e 7d 0d 0d |ose a wi|ndow.}..|
|000022e0| 7b 20 31 2e 30 31 20 2d | 20 41 74 20 74 68 69 73 |{ 1.01 -| At this|
|000022f0| 20 70 6f 69 6e 74 2c 20 | 69 66 20 74 68 65 72 65 | point, |if there|
|00002300| 20 77 61 73 20 61 20 64 | 6f 63 75 6d 65 6e 74 20 | was a d|ocument |
|00002310| 61 73 73 6f 63 69 61 74 | 65 64 20 77 69 74 68 20 |associat|ed with |
|00002320| 61 0d 20 77 69 6e 64 6f | 77 2c 20 79 6f 75 20 63 |a. windo|w, you c|
|00002330| 6f 75 6c 64 20 64 6f 20 | 61 6e 79 20 64 6f 63 75 |ould do |any docu|
|00002340| 6d 65 6e 74 20 73 61 76 | 69 6e 67 20 70 72 6f 63 |ment sav|ing proc|
|00002350| 65 73 73 69 6e 67 20 69 | 66 20 69 74 20 69 73 20 |essing i|f it is |
|00002360| 27 64 69 72 74 79 27 2e | 0d 20 44 6f 43 6c 6f 73 |'dirty'.|. DoClos|
|00002370| 65 57 69 6e 64 6f 77 20 | 77 6f 75 6c 64 20 72 65 |eWindow |would re|
|00002380| 74 75 72 6e 20 54 52 55 | 45 20 69 66 20 74 68 65 |turn TRU|E if the|
|00002390| 20 77 69 6e 64 6f 77 20 | 61 63 74 75 61 6c 6c 79 | window |actually|
|000023a0| 20 63 6c 6f 73 65 73 2c | 20 69 2e 65 2e 2c 0d 20 | closes,| i.e.,. |
|000023b0| 74 68 65 20 75 73 65 72 | 20 64 6f 65 73 20 6e 6f |the user| does no|
|000023c0| 74 20 63 61 6e 63 65 6c | 20 66 72 6f 6d 20 61 20 |t cancel| from a |
|000023d0| 73 61 76 65 20 64 69 61 | 6c 6f 67 2e 20 54 68 69 |save dia|log. Thi|
|000023e0| 73 20 72 65 73 75 6c 74 | 20 69 73 20 68 61 6e 64 |s result| is hand|
|000023f0| 79 20 77 68 65 6e 0d 20 | 74 68 65 20 75 73 65 72 |y when. |the user|
|00002400| 20 71 75 69 74 73 20 61 | 6e 20 61 70 70 6c 69 63 | quits a|n applic|
|00002410| 61 74 69 6f 6e 2c 20 62 | 75 74 20 74 68 65 6e 20 |ation, b|ut then |
|00002420| 63 61 6e 63 65 6c 73 20 | 61 20 73 61 76 65 20 6f |cancels |a save o|
|00002430| 66 20 61 20 64 6f 63 75 | 6d 65 6e 74 0d 20 61 73 |f a docu|ment. as|
|00002440| 73 6f 63 69 61 74 65 64 | 20 77 69 74 68 20 61 20 |sociated| with a |
|00002450| 77 69 6e 64 6f 77 2e 20 | 57 65 20 61 6c 73 6f 20 |window. |We also |
|00002460| 61 64 64 65 64 20 63 6f | 64 65 20 74 6f 20 63 6c |added co|de to cl|
|00002470| 6f 73 65 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |ose the |applicat|
|00002480| 69 6f 6e 0d 20 77 69 6e | 64 6f 77 20 73 69 6e 63 |ion. win|dow sinc|
|00002490| 65 20 6f 74 68 65 72 77 | 69 73 65 2c 20 74 68 65 |e otherw|ise, the|
|000024a0| 20 74 65 72 6d 69 6e 61 | 74 69 6f 6e 20 72 6f 75 | termina|tion rou|
|000024b0| 74 69 6e 65 73 20 77 6f | 75 6c 64 20 6e 65 76 65 |tines wo|uld neve|
|000024c0| 72 20 73 74 6f 70 20 6c | 6f 6f 70 69 6e 67 2c 0d |r stop l|ooping,.|
|000024d0| 20 77 61 69 74 69 6e 67 | 20 66 6f 72 20 46 72 6f | waiting| for Fro|
|000024e0| 6e 74 57 69 6e 64 6f 77 | 20 74 6f 20 72 65 74 75 |ntWindow| to retu|
|000024f0| 72 6e 20 4e 49 4c 2e 7d | 0d 0d 42 45 47 49 4e 0d |rn NIL.}|..BEGIN.|
|00002500| 09 44 6f 43 6c 6f 73 65 | 57 69 6e 64 6f 77 20 3a |.DoClose|Window :|
|00002510| 3d 20 54 52 55 45 3b 0d | 09 49 46 20 49 73 44 41 |= TRUE;.|.IF IsDA|
|00002520| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 20 54 |Window(w|indow) T|
|00002530| 48 45 4e 0d 09 09 43 6c | 6f 73 65 44 65 73 6b 41 |HEN...Cl|oseDeskA|
|00002540| 63 63 28 57 69 6e 64 6f | 77 50 65 65 6b 28 77 69 |cc(Windo|wPeek(wi|
|00002550| 6e 64 6f 77 29 5e 2e 77 | 69 6e 64 6f 77 4b 69 6e |ndow)^.w|indowKin|
|00002560| 64 29 3b 0d 09 49 46 20 | 49 73 41 70 70 57 69 6e |d);..IF |IsAppWin|
|00002570| 64 6f 77 28 77 69 6e 64 | 6f 77 29 20 54 48 45 4e |dow(wind|ow) THEN|
|00002580| 0d 09 09 43 6c 6f 73 65 | 57 69 6e 64 6f 77 28 77 |...Close|Window(w|
|00002590| 69 6e 64 6f 77 29 3b 0d | 45 4e 44 3b 20 7b 44 6f |indow);.|END; {Do|
|000025a0| 43 6c 6f 73 65 57 69 6e | 64 6f 77 7d 0d 0d 0d 7b |CloseWin|dow}...{|
|000025b0| 24 53 20 49 6e 69 74 69 | 61 6c 69 7a 65 7d 0d 46 |$S Initi|alize}.F|
|000025c0| 55 4e 43 54 49 4f 4e 20 | 47 6f 47 65 74 52 65 63 |UNCTION |GoGetRec|
|000025d0| 74 28 72 65 63 74 49 44 | 3a 20 49 4e 54 45 47 45 |t(rectID|: INTEGE|
|000025e0| 52 3b 20 56 41 52 20 74 | 68 65 52 65 63 74 3a 20 |R; VAR t|heRect: |
|000025f0| 52 65 63 74 29 20 3a 20 | 42 4f 4f 4c 45 41 4e 3b |Rect) : |BOOLEAN;|
|00002600| 0d 20 0d 7b 54 68 69 73 | 20 75 74 69 6c 69 74 79 |. .{This| utility|
|00002610| 20 6c 6f 61 64 73 20 74 | 68 65 20 67 6c 6f 62 61 | loads t|he globa|
|00002620| 6c 20 72 65 63 74 61 6e | 67 6c 65 73 20 74 68 61 |l rectan|gles tha|
|00002630| 74 20 61 72 65 20 75 73 | 65 64 20 62 79 20 74 68 |t are us|ed by th|
|00002640| 65 20 77 69 6e 64 6f 77 | 0d 20 64 72 61 77 69 6e |e window|. drawin|
|00002650| 67 20 72 6f 75 74 69 6e | 65 73 2e 20 49 74 20 73 |g routin|es. It s|
|00002660| 68 6f 77 73 20 68 6f 77 | 20 74 68 65 20 72 65 73 |hows how| the res|
|00002670| 6f 75 72 63 65 20 6d 61 | 6e 61 67 65 72 20 63 61 |ource ma|nager ca|
|00002680| 6e 20 62 65 20 75 73 65 | 64 20 74 6f 20 68 6f 6c |n be use|d to hol|
|00002690| 64 0d 20 76 61 6c 75 65 | 73 20 69 6e 20 61 20 63 |d. value|s in a c|
|000026a0| 6f 6e 76 65 6e 69 65 6e | 74 20 6d 61 6e 6e 65 72 |onvenien|t manner|
|000026b0| 2e 20 54 68 65 73 65 20 | 76 61 6c 75 65 73 20 61 |. These |values a|
|000026c0| 72 65 20 74 68 65 6e 20 | 65 61 73 69 6c 79 20 61 |re then |easily a|
|000026d0| 6c 74 65 72 65 64 20 77 | 69 74 68 6f 75 74 0d 20 |ltered w|ithout. |
|000026e0| 68 61 76 69 6e 67 20 74 | 6f 20 72 65 2d 63 6f 6d |having t|o re-com|
|000026f0| 70 69 6c 65 20 74 68 65 | 20 73 6f 75 72 63 65 20 |pile the| source |
|00002700| 63 6f 64 65 2e 20 49 6e | 20 74 68 69 73 20 70 61 |code. In| this pa|
|00002710| 72 74 69 63 75 6c 61 72 | 20 63 61 73 65 2c 20 77 |rticular| case, w|
|00002720| 65 20 6b 6e 6f 77 0d 20 | 74 68 61 74 20 74 68 69 |e know. |that thi|
|00002730| 73 20 72 6f 75 74 69 6e | 65 20 69 73 20 62 65 69 |s routin|e is bei|
|00002740| 6e 67 20 63 61 6c 6c 65 | 64 20 61 74 20 69 6e 69 |ng calle|d at ini|
|00002750| 74 69 61 6c 69 7a 61 74 | 69 6f 6e 20 74 69 6d 65 |tializat|ion time|
|00002760| 2e 20 54 68 65 72 65 66 | 6f 72 65 2c 0d 20 69 66 |. Theref|ore,. if|
|00002770| 20 74 68 69 73 20 72 65 | 74 75 72 6e 73 20 46 41 | this re|turns FA|
|00002780| 4c 53 45 2c 20 77 65 20 | 77 69 6c 6c 20 61 73 73 |LSE, we |will ass|
|00002790| 75 6d 65 20 74 68 61 74 | 20 74 68 65 20 61 70 70 |ume that| the app|
|000027a0| 6c 69 63 61 74 69 6f 6e | 20 69 73 20 69 6e 20 73 |lication| is in s|
|000027b0| 75 63 68 0d 20 62 61 64 | 20 73 68 61 70 65 20 74 |uch. bad| shape t|
|000027c0| 68 61 74 20 77 65 20 73 | 68 6f 75 6c 64 20 6a 75 |hat we s|hould ju|
|000027d0| 73 74 20 65 78 69 74 2e | 20 59 6f 75 72 20 65 72 |st exit.| Your er|
|000027e0| 72 6f 72 20 68 61 6e 64 | 6c 69 6e 67 20 6d 61 79 |ror hand|ling may|
|000027f0| 20 64 69 66 66 65 72 2c | 20 62 75 74 0d 20 74 68 | differ,| but. th|
|00002800| 65 20 63 68 65 63 6b 20 | 73 68 6f 75 6c 64 20 73 |e check |should s|
|00002810| 74 69 6c 6c 20 62 65 20 | 6d 61 64 65 2e 7d 0d 0d |till be |made.}..|
|00002820| 7b 31 2e 30 31 20 2d 20 | 43 68 61 6e 67 65 64 20 |{1.01 - |Changed |
|00002830| 47 6f 47 65 74 52 65 63 | 74 20 74 6f 20 72 65 74 |GoGetRec|t to ret|
|00002840| 75 72 6e 20 61 20 42 4f | 4f 4c 45 41 4e 20 74 68 |urn a BO|OLEAN th|
|00002850| 61 74 20 69 6e 64 69 63 | 61 74 65 73 20 69 66 20 |at indic|ates if |
|00002860| 69 74 20 77 61 73 20 73 | 75 63 63 65 73 73 66 75 |it was s|uccessfu|
|00002870| 6c 0d 20 69 6e 20 67 65 | 74 74 69 6e 67 20 74 68 |l. in ge|tting th|
|00002880| 65 20 72 65 63 74 61 6e | 67 6c 65 20 72 61 74 68 |e rectan|gle rath|
|00002890| 65 72 20 74 68 61 6e 20 | 6a 75 73 74 20 64 6f 69 |er than |just doi|
|000028a0| 6e 67 20 45 78 69 74 54 | 6f 53 68 65 6c 6c 2e 7d |ng ExitT|oShell.}|
|000028b0| 0d 20 0d 54 59 50 45 0d | 09 52 65 63 74 50 74 72 |. .TYPE.|.RectPtr|
|000028c0| 09 09 3d 20 5e 52 65 63 | 74 3b 0d 09 52 65 63 74 |..= ^Rec|t;..Rect|
|000028d0| 48 6e 64 09 09 3d 20 5e | 52 65 63 74 50 74 72 3b |Hnd..= ^|RectPtr;|
|000028e0| 0d 56 41 52 0d 09 72 65 | 73 6f 75 72 63 65 09 3a |.VAR..re|source.:|
|000028f0| 20 48 61 6e 64 6c 65 3b | 0d 42 45 47 49 4e 0d 09 | Handle;|.BEGIN..|
|00002900| 72 65 73 6f 75 72 63 65 | 20 3a 3d 20 47 65 74 52 |resource| := GetR|
|00002910| 65 73 6f 75 72 63 65 28 | 27 52 45 43 54 27 2c 20 |esource(|'RECT', |
|00002920| 72 65 63 74 49 44 29 3b | 0d 09 49 46 20 72 65 73 |rectID);|..IF res|
|00002930| 6f 75 72 63 65 20 3c 3e | 20 4e 49 4c 20 54 48 45 |ource <>| NIL THE|
|00002940| 4e 20 42 45 47 49 4e 0d | 09 09 47 6f 47 65 74 52 |N BEGIN.|..GoGetR|
|00002950| 65 63 74 20 3a 3d 20 54 | 52 55 45 3b 0d 09 09 74 |ect := T|RUE;...t|
|00002960| 68 65 52 65 63 74 20 3a | 3d 20 52 65 63 74 48 6e |heRect :|= RectHn|
|00002970| 64 28 72 65 73 6f 75 72 | 63 65 29 5e 5e 3b 0d 09 |d(resour|ce)^^;..|
|00002980| 09 45 4e 44 0d 09 45 4c | 53 45 0d 09 09 47 6f 47 |.END..EL|SE...GoG|
|00002990| 65 74 52 65 63 74 20 3a | 3d 20 46 41 4c 53 45 3b |etRect :|= FALSE;|
|000029a0| 0d 45 4e 44 3b 20 7b 47 | 6f 47 65 74 52 65 63 74 |.END; {G|oGetRect|
|000029b0| 7d 0d 0d 0d 7b 24 53 20 | 49 6e 69 74 69 61 6c 69 |}...{$S |Initiali|
|000029c0| 7a 65 7d 0d 50 52 4f 43 | 45 44 55 52 45 20 49 6e |ze}.PROC|EDURE In|
|000029d0| 69 74 69 61 6c 69 7a 65 | 3b 0d 0d 7b 53 65 74 20 |itialize|;..{Set |
|000029e0| 75 70 20 74 68 65 20 77 | 68 6f 6c 65 20 77 6f 72 |up the w|hole wor|
|000029f0| 6c 64 2c 20 69 6e 63 6c | 75 64 69 6e 67 20 67 6c |ld, incl|uding gl|
|00002a00| 6f 62 61 6c 20 76 61 72 | 69 61 62 6c 65 73 2c 20 |obal var|iables, |
|00002a10| 54 6f 6f 6c 62 6f 78 20 | 6d 61 6e 61 67 65 72 73 |Toolbox |managers|
|00002a20| 2c 0d 20 61 6e 64 20 6d | 65 6e 75 73 2e 20 57 65 |,. and m|enus. We|
|00002a30| 20 61 6c 73 6f 20 63 72 | 65 61 74 65 20 6f 75 72 | also cr|eate our|
|00002a40| 20 6f 6e 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | one app|lication|
|00002a50| 20 77 69 6e 64 6f 77 20 | 61 74 20 74 68 69 73 20 | window |at this |
|00002a60| 74 69 6d 65 2e 0d 20 53 | 69 6e 63 65 20 77 69 6e |time.. S|ince win|
|00002a70| 64 6f 77 20 73 74 6f 72 | 61 67 65 20 69 73 20 6e |dow stor|age is n|
|00002a80| 6f 6e 2d 72 65 6c 6f 63 | 61 74 65 61 62 6c 65 2c |on-reloc|ateable,|
|00002a90| 20 68 6f 77 20 61 6e 64 | 20 77 68 65 6e 20 74 6f | how and| when to|
|00002aa0| 20 61 6c 6c 6f 63 61 74 | 65 20 73 70 61 63 65 0d | allocat|e space.|
|00002ab0| 20 66 6f 72 20 77 69 6e | 64 6f 77 73 20 69 73 20 | for win|dows is |
|00002ac0| 76 65 72 79 20 69 6d 70 | 6f 72 74 61 6e 74 20 73 |very imp|ortant s|
|00002ad0| 6f 20 74 68 61 74 20 68 | 65 61 70 20 66 72 61 67 |o that h|eap frag|
|00002ae0| 6d 65 6e 74 61 74 69 6f | 6e 20 64 6f 65 73 20 6e |mentatio|n does n|
|00002af0| 6f 74 20 6f 63 63 75 72 | 2e 0d 20 42 65 63 61 75 |ot occur|.. Becau|
|00002b00| 73 65 20 53 61 6d 70 6c | 65 20 68 61 73 20 6f 6e |se Sampl|e has on|
|00002b10| 6c 79 20 6f 6e 65 20 77 | 69 6e 64 6f 77 20 61 6e |ly one w|indow an|
|00002b20| 64 20 69 74 20 69 73 20 | 6f 6e 6c 79 20 64 69 73 |d it is |only dis|
|00002b30| 70 6f 73 65 64 20 77 68 | 65 6e 20 74 68 65 20 61 |posed wh|en the a|
|00002b40| 70 70 6c 69 63 61 74 69 | 6f 6e 0d 20 71 75 69 74 |pplicati|on. quit|
|00002b50| 73 2c 20 77 65 20 77 69 | 6c 6c 20 61 6c 6c 6f 63 |s, we wi|ll alloc|
|00002b60| 61 74 65 20 69 74 73 20 | 73 70 61 63 65 20 68 65 |ate its |space he|
|00002b70| 72 65 2c 20 62 65 66 6f | 72 65 20 61 6e 79 74 68 |re, befo|re anyth|
|00002b80| 69 6e 67 20 74 68 61 74 | 20 6d 69 67 68 74 20 62 |ing that| might b|
|00002b90| 65 20 61 20 6c 6f 63 6b | 65 64 0d 20 72 65 6c 6f |e a lock|ed. relo|
|00002ba0| 63 61 74 61 62 6c 65 20 | 6f 62 6a 65 63 74 20 67 |catable |object g|
|00002bb0| 65 74 73 20 69 6e 74 6f | 20 74 68 65 20 68 65 61 |ets into| the hea|
|00002bc0| 70 2e 20 54 68 69 73 20 | 77 61 79 2c 20 77 65 20 |p. This |way, we |
|00002bd0| 63 61 6e 20 66 6f 72 63 | 65 20 69 74 73 20 73 74 |can forc|e its st|
|00002be0| 6f 72 61 67 65 20 74 6f | 20 62 65 0d 20 69 6e 20 |orage to| be. in |
|00002bf0| 74 68 65 20 6c 6f 77 65 | 73 74 20 6d 65 6d 6f 72 |the lowe|st memor|
|00002c00| 79 20 61 76 61 69 6c 61 | 62 6c 65 20 69 6e 20 74 |y availa|ble in t|
|00002c10| 68 65 20 68 65 61 70 2e | 20 57 69 6e 64 6f 77 20 |he heap.| Window |
|00002c20| 73 74 6f 72 61 67 65 20 | 63 61 6e 20 64 69 66 66 |storage |can diff|
|00002c30| 65 72 20 77 69 64 65 6c | 79 0d 20 61 6d 6f 6e 67 |er widel|y. among|
|00002c40| 73 74 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 73 20 |st appli|cations |
|00002c50| 64 65 70 65 6e 64 69 6e | 67 20 6f 6e 20 68 6f 77 |dependin|g on how|
|00002c60| 20 6d 61 6e 79 20 77 69 | 6e 64 6f 77 73 20 61 72 | many wi|ndows ar|
|00002c70| 65 20 63 72 65 61 74 65 | 64 20 61 6e 64 20 64 69 |e create|d and di|
|00002c80| 73 70 6f 73 65 64 2e 0d | 20 49 66 20 61 20 66 61 |sposed..| If a fa|
|00002c90| 69 6c 75 72 65 20 6f 63 | 63 75 72 73 20 68 65 72 |ilure oc|curs her|
|00002ca0| 65 2c 20 77 65 20 77 69 | 6c 6c 20 63 6f 6e 73 69 |e, we wi|ll consi|
|00002cb0| 64 65 72 20 74 68 61 74 | 20 74 68 65 20 61 70 70 |der that| the app|
|00002cc0| 6c 69 63 61 74 69 6f 6e | 20 69 73 20 69 6e 20 73 |lication| is in s|
|00002cd0| 75 63 68 0d 20 62 61 64 | 20 73 68 61 70 65 20 74 |uch. bad| shape t|
|00002ce0| 68 61 74 20 77 65 20 73 | 68 6f 75 6c 64 20 6a 75 |hat we s|hould ju|
|00002cf0| 73 74 20 65 78 69 74 2e | 20 59 6f 75 72 20 65 72 |st exit.| Your er|
|00002d00| 72 6f 72 20 68 61 6e 64 | 6c 69 6e 67 20 6d 61 79 |ror hand|ling may|
|00002d10| 20 64 69 66 66 65 72 2c | 20 62 75 74 0d 20 74 68 | differ,| but. th|
|00002d20| 65 20 63 68 65 63 6b 73 | 20 73 68 6f 75 6c 64 20 |e checks| should |
|00002d30| 73 74 69 6c 6c 20 62 65 | 20 6d 61 64 65 2e 7d 0d |still be| made.}.|
|00002d40| 20 0d 7b 31 2e 30 31 20 | 2d 20 54 68 65 20 63 6f | .{1.01 |- The co|
|00002d50| 64 65 20 74 68 61 74 20 | 75 73 65 64 20 74 6f 20 |de that |used to |
|00002d60| 62 65 20 70 61 72 74 20 | 6f 66 20 46 6f 72 63 65 |be part |of Force|
|00002d70| 45 6e 76 69 72 6f 6e 73 | 20 68 61 73 20 62 65 65 |Environs| has bee|
|00002d80| 6e 20 6d 6f 76 65 64 20 | 69 6e 74 6f 0d 20 74 68 |n moved |into. th|
|00002d90| 69 73 20 6d 6f 64 75 6c | 65 2e 20 49 66 20 61 6e |is modul|e. If an|
|00002da0| 20 65 72 72 6f 72 20 69 | 73 20 64 65 74 65 63 74 | error i|s detect|
|00002db0| 65 64 2c 20 69 6e 73 74 | 65 61 64 20 6f 66 20 6d |ed, inst|ead of m|
|00002dc0| 65 72 65 6c 79 20 64 6f | 69 6e 67 20 61 6e 20 45 |erely do|ing an E|
|00002dd0| 78 69 74 54 6f 53 68 65 | 6c 6c 2c 0d 20 77 68 69 |xitToShe|ll,. whi|
|00002de0| 63 68 20 6c 65 61 76 65 | 73 20 74 68 65 20 75 73 |ch leave|s the us|
|00002df0| 65 72 20 77 69 74 68 6f | 75 74 20 6d 75 63 68 20 |er witho|ut much |
|00002e00| 74 6f 20 67 6f 20 6f 6e | 2c 20 77 65 20 63 61 6c |to go on|, we cal|
|00002e10| 6c 20 41 6c 65 72 74 55 | 73 65 72 2c 20 77 68 69 |l AlertU|ser, whi|
|00002e20| 63 68 20 70 75 74 73 0d | 20 75 70 20 61 20 73 69 |ch puts.| up a si|
|00002e30| 6d 70 6c 65 20 61 6c 65 | 72 74 20 74 68 61 74 20 |mple ale|rt that |
|00002e40| 6a 75 73 74 20 73 61 79 | 73 20 61 6e 20 65 72 72 |just say|s an err|
|00002e50| 6f 72 20 6f 63 63 75 72 | 72 65 64 20 61 6e 64 20 |or occur|red and |
|00002e60| 74 68 65 6e 20 63 61 6c | 6c 73 20 45 78 69 74 54 |then cal|ls ExitT|
|00002e70| 6f 53 68 65 6c 6c 2e 0d | 20 49 6e 20 74 68 65 20 |oShell..| In the |
|00002e80| 69 6e 74 65 72 65 73 74 | 73 20 6f 66 20 6b 65 65 |interest|s of kee|
|00002e90| 70 69 6e 67 20 74 68 69 | 6e 67 73 20 73 69 6d 70 |ping thi|ngs simp|
|00002ea0| 6c 65 2c 20 74 68 65 20 | 61 6c 65 72 74 20 64 6f |le, the |alert do|
|00002eb0| 65 73 20 6e 6f 74 20 73 | 74 61 74 65 20 74 68 65 |es not s|tate the|
|00002ec0| 20 73 70 65 63 69 66 69 | 63 0d 20 63 61 75 73 65 | specifi|c. cause|
|00002ed0| 20 6f 66 20 74 68 65 20 | 65 72 72 6f 72 2c 20 62 | of the |error, b|
|00002ee0| 75 74 20 61 20 6d 6f 72 | 65 20 69 6e 66 6f 72 6d |ut a mor|e inform|
|00002ef0| 61 74 69 76 65 20 61 6c | 65 72 74 20 77 6f 75 6c |ative al|ert woul|
|00002f00| 64 20 62 65 20 61 70 70 | 72 6f 70 72 69 61 74 65 |d be app|ropriate|
|00002f10| 20 66 6f 72 20 6d 6f 72 | 65 0d 20 73 6f 70 68 69 | for mor|e. sophi|
|00002f20| 73 74 69 63 61 74 65 64 | 20 61 70 70 6c 69 63 61 |sticated| applica|
|00002f30| 74 69 6f 6e 73 2e 20 53 | 69 6e 63 65 20 74 68 65 |tions. S|ince the|
|00002f40| 72 65 20 69 73 20 6e 6f | 20 6f 74 68 65 72 20 63 |re is no| other c|
|00002f50| 6c 65 61 6e 75 70 20 6e | 65 65 64 65 64 20 61 74 |leanup n|eeded at|
|00002f60| 20 74 68 69 73 20 70 6f | 69 6e 74 0d 20 69 66 20 | this po|int. if |
|00002f70| 61 6e 20 65 72 72 6f 72 | 20 69 73 20 64 65 74 65 |an error| is dete|
|00002f80| 63 74 65 64 2c 20 74 68 | 69 73 20 66 6f 72 6d 20 |cted, th|is form |
|00002f90| 6f 66 20 65 72 72 6f 72 | 2d 20 68 61 6e 64 6c 69 |of error|- handli|
|00002fa0| 6e 67 20 69 73 20 61 63 | 63 65 70 74 61 62 6c 65 |ng is ac|ceptable|
|00002fb0| 2e 20 49 66 20 6d 6f 72 | 65 0d 20 73 6f 70 68 69 |. If mor|e. sophi|
|00002fc0| 73 74 69 63 61 74 65 64 | 20 65 72 72 6f 72 20 72 |sticated| error r|
|00002fd0| 65 63 6f 76 65 72 79 20 | 69 73 20 6e 65 65 64 65 |ecovery |is neede|
|00002fe0| 64 2c 20 61 20 73 69 67 | 6e 61 6c 20 6d 65 63 68 |d, a sig|nal mech|
|00002ff0| 61 6e 69 73 6d 2c 20 73 | 75 63 68 20 61 73 20 69 |anism, s|uch as i|
|00003000| 73 20 70 72 6f 76 69 64 | 65 64 0d 20 62 79 20 53 |s provid|ed. by S|
|00003010| 69 67 6e 61 6c 73 2c 20 | 63 61 6e 20 62 65 20 75 |ignals, |can be u|
|00003020| 73 65 64 2e 7d 0d 0d 56 | 41 52 0d 09 6d 65 6e 75 |sed.}..V|AR..menu|
|00003030| 42 61 72 09 09 09 3a 20 | 48 61 6e 64 6c 65 3b 0d |Bar...: |Handle;.|
|00003040| 09 77 69 6e 64 6f 77 09 | 09 09 3a 20 57 69 6e 64 |.window.|..: Wind|
|00003050| 6f 77 50 74 72 3b 0d 09 | 69 67 6e 6f 72 65 45 72 |owPtr;..|ignoreEr|
|00003060| 72 6f 72 09 09 3a 20 4f | 53 45 72 72 3b 0d 09 74 |ror..: O|SErr;..t|
|00003070| 6f 74 61 6c 2c 20 63 6f | 6e 74 69 67 09 3a 20 4c |otal, co|ntig.: L|
|00003080| 6f 6e 67 49 6e 74 3b 0d | 09 69 67 6e 6f 72 65 52 |ongInt;.|.ignoreR|
|00003090| 65 73 75 6c 74 09 3a 20 | 42 4f 4f 4c 45 41 4e 3b |esult.: |BOOLEAN;|
|000030a0| 0d 09 65 76 65 6e 74 09 | 09 09 3a 20 45 76 65 6e |..event.|..: Even|
|000030b0| 74 52 65 63 6f 72 64 3b | 0d 09 63 6f 75 6e 74 09 |tRecord;|..count.|
|000030c0| 09 09 3a 20 49 4e 54 45 | 47 45 52 3b 0d 0d 42 45 |..: INTE|GER;..BE|
|000030d0| 47 49 4e 0d 09 67 48 61 | 73 57 61 69 74 4e 65 78 |GIN..gHa|sWaitNex|
|000030e0| 74 45 76 65 6e 74 20 3a | 3d 20 54 72 61 70 41 76 |tEvent :|= TrapAv|
|000030f0| 61 69 6c 61 62 6c 65 28 | 5f 57 61 69 74 4e 65 78 |ailable(|_WaitNex|
|00003100| 74 45 76 65 6e 74 2c 20 | 54 6f 6f 6c 54 72 61 70 |tEvent, |ToolTrap|
|00003110| 29 3b 0d 09 67 49 6e 42 | 61 63 6b 67 72 6f 75 6e |);..gInB|ackgroun|
|00003120| 64 20 3a 3d 20 46 41 4c | 53 45 3b 0d 0d 09 49 6e |d := FAL|SE;...In|
|00003130| 69 74 47 72 61 66 28 40 | 74 68 65 50 6f 72 74 29 |itGraf(@|thePort)|
|00003140| 3b 0d 09 49 6e 69 74 46 | 6f 6e 74 73 3b 0d 09 49 |;..InitF|onts;..I|
|00003150| 6e 69 74 57 69 6e 64 6f | 77 73 3b 0d 09 49 6e 69 |nitWindo|ws;..Ini|
|00003160| 74 4d 65 6e 75 73 3b 0d | 09 54 45 49 6e 69 74 3b |tMenus;.|.TEInit;|
|00003170| 0d 09 49 6e 69 74 44 69 | 61 6c 6f 67 73 28 4e 49 |..InitDi|alogs(NI|
|00003180| 4c 29 3b 0d 09 49 6e 69 | 74 43 75 72 73 6f 72 3b |L);..Ini|tCursor;|
|00003190| 0d 09 0d 09 7b 43 61 6c | 6c 20 4d 50 50 4f 70 65 |....{Cal|l MPPOpe|
|000031a0| 6e 20 61 6e 64 20 41 54 | 50 4c 6f 61 64 20 61 74 |n and AT|PLoad at|
|000031b0| 20 74 68 69 73 20 70 6f | 69 6e 74 20 74 6f 20 69 | this po|int to i|
|000031c0| 6e 69 74 69 61 6c 69 7a | 65 20 41 70 70 6c 65 54 |nitializ|e AppleT|
|000031d0| 61 6c 6b 2c 0d 09 20 69 | 66 20 79 6f 75 20 61 72 |alk,.. i|f you ar|
|000031e0| 65 20 75 73 69 6e 67 20 | 69 74 2e 7d 0d 09 7b 4e |e using |it.}..{N|
|000031f0| 4f 54 45 20 2d 2d 20 49 | 74 20 69 73 20 6e 6f 20 |OTE -- I|t is no |
|00003200| 6c 6f 6e 67 65 72 20 6e | 65 63 65 73 73 61 72 79 |longer n|ecessary|
|00003210| 2c 20 61 6e 64 20 61 63 | 74 75 61 6c 6c 79 20 75 |, and ac|tually u|
|00003220| 6e 68 65 61 6c 74 68 79 | 2c 20 74 6f 20 63 68 65 |nhealthy|, to che|
|00003230| 63 6b 0d 09 20 50 6f 72 | 74 42 55 73 65 20 61 6e |ck.. Por|tBUse an|
|00003240| 64 20 53 50 43 6f 6e 66 | 69 67 20 62 65 66 6f 72 |d SPConf|ig befor|
|00003250| 65 20 6f 70 65 6e 69 6e | 67 20 41 70 70 6c 65 54 |e openin|g AppleT|
|00003260| 61 6c 6b 2e 20 54 68 65 | 20 64 72 69 76 65 72 73 |alk. The| drivers|
|00003270| 20 61 72 65 20 63 61 70 | 61 62 6c 65 0d 09 20 6f | are cap|able.. o|
|00003280| 66 20 63 68 65 63 6b 69 | 6e 67 20 66 6f 72 20 70 |f checki|ng for p|
|00003290| 6f 72 74 20 61 76 61 69 | 6c 61 62 69 6c 69 74 79 |ort avai|lability|
|000032a0| 20 74 68 65 6d 73 65 6c | 76 65 73 2e 7d 0d 09 0d | themsel|ves.}...|
|000032b0| 09 7b 4e 6f 77 20 74 68 | 69 73 20 6e 65 78 74 20 |.{Now th|is next |
|000032c0| 62 69 74 20 6f 66 20 63 | 6f 64 65 20 6d 61 79 20 |bit of c|ode may |
|000032d0| 6d 61 6b 65 20 79 6f 75 | 20 74 6f 73 73 20 79 6f |make you| toss yo|
|000032e0| 75 72 20 63 6f 6f 6b 69 | 65 73 2c 20 62 75 74 20 |ur cooki|es, but |
|000032f0| 69 74 20 69 73 0d 09 20 | 6e 65 63 65 73 73 61 72 |it is.. |necessar|
|00003300| 79 20 74 6f 20 61 6c 6c | 6f 77 20 74 68 65 20 64 |y to all|ow the d|
|00003310| 65 66 61 75 6c 74 20 62 | 75 74 74 6f 6e 20 6f 66 |efault b|utton of|
|00003320| 20 6f 75 72 20 61 6c 65 | 72 74 20 62 65 20 6f 75 | our ale|rt be ou|
|00003330| 74 6c 69 6e 65 64 2e 7d | 0d 09 20 0d 09 46 4f 52 |tlined.}|.. ..FOR|
|00003340| 20 63 6f 75 6e 74 20 3a | 3d 20 31 20 54 4f 20 33 | count :|= 1 TO 3|
|00003350| 20 44 4f 0d 09 09 69 67 | 6e 6f 72 65 52 65 73 75 | DO...ig|noreResu|
|00003360| 6c 74 20 3a 3d 20 47 65 | 74 4e 65 78 74 45 76 65 |lt := Ge|tNextEve|
|00003370| 6e 74 28 65 76 65 72 79 | 45 76 65 6e 74 2c 20 65 |nt(every|Event, e|
|00003380| 76 65 6e 74 29 3b 0d 09 | 0d 09 7b 49 67 6e 6f 72 |vent);..|..{Ignor|
|00003390| 65 20 74 68 65 20 65 72 | 72 6f 72 20 72 65 74 75 |e the er|ror retu|
|000033a0| 72 6e 65 64 20 66 72 6f | 6d 20 53 79 73 45 6e 76 |rned fro|m SysEnv|
|000033b0| 69 72 6f 6e 73 3b 20 65 | 76 65 6e 20 69 66 20 61 |irons; e|ven if a|
|000033c0| 6e 20 65 72 72 6f 72 20 | 6f 63 63 75 72 72 65 64 |n error |occurred|
|000033d0| 2c 0d 09 20 74 68 65 20 | 53 79 73 45 6e 76 69 72 |,.. the |SysEnvir|
|000033e0| 6f 6e 73 20 67 6c 75 65 | 20 77 69 6c 6c 20 66 69 |ons glue| will fi|
|000033f0| 6c 6c 20 69 6e 20 74 68 | 65 20 53 79 73 45 6e 76 |ll in th|e SysEnv|
|00003400| 52 65 63 2e 20 59 6f 75 | 20 63 61 6e 20 73 61 76 |Rec. You| can sav|
|00003410| 65 20 61 20 72 65 64 75 | 6e 64 61 6e 74 0d 09 20 |e a redu|ndant.. |
|00003420| 63 61 6c 6c 20 74 6f 20 | 53 79 73 45 6e 76 69 72 |call to |SysEnvir|
|00003430| 6f 6e 73 20 62 79 20 63 | 61 6c 6c 69 6e 67 20 69 |ons by c|alling i|
|00003440| 74 20 61 66 74 65 72 20 | 69 6e 69 74 69 61 6c 69 |t after |initiali|
|00003450| 7a 69 6e 67 20 41 70 70 | 6c 65 54 61 6c 6b 2e 7d |zing App|leTalk.}|
|00003460| 0d 09 20 0d 09 69 67 6e | 6f 72 65 45 72 72 6f 72 |.. ..ign|oreError|
|00003470| 20 3a 3d 20 53 79 73 45 | 6e 76 69 72 6f 6e 73 28 | := SysE|nvirons(|
|00003480| 6b 53 79 73 45 6e 76 69 | 72 6f 6e 73 56 65 72 73 |kSysEnvi|ronsVers|
|00003490| 69 6f 6e 2c 20 67 4d 61 | 63 29 3b 0d 09 0d 09 7b |ion, gMa|c);....{|
|000034a0| 4d 61 6b 65 20 73 75 72 | 65 20 74 68 61 74 20 74 |Make sur|e that t|
|000034b0| 68 65 20 6d 61 63 68 69 | 6e 65 20 68 61 73 20 61 |he machi|ne has a|
|000034c0| 74 20 6c 65 61 73 74 20 | 31 32 38 4b 20 52 4f 4d |t least |128K ROM|
|000034d0| 73 2e 20 49 66 20 69 74 | 20 64 6f 65 73 6e 27 74 |s. If it| doesn't|
|000034e0| 2c 20 65 78 69 74 2e 7d | 0d 09 0d 09 49 46 20 67 |, exit.}|....IF g|
|000034f0| 4d 61 63 2e 6d 61 63 68 | 69 6e 65 54 79 70 65 20 |Mac.mach|ineType |
|00003500| 3c 20 30 20 54 48 45 4e | 20 41 6c 65 72 74 55 73 |< 0 THEN| AlertUs|
|00003510| 65 72 3b 0d 09 0d 09 7b | 31 2e 30 31 20 2d 20 57 |er;....{|1.01 - W|
|00003520| 65 20 75 73 65 64 20 74 | 6f 20 6d 61 6b 65 20 61 |e used t|o make a|
|00003530| 20 63 68 65 63 6b 20 66 | 6f 72 20 6d 65 6d 6f 72 | check f|or memor|
|00003540| 79 20 61 74 20 74 68 69 | 73 20 70 6f 69 6e 74 20 |y at thi|s point |
|00003550| 62 79 20 65 78 61 6d 69 | 6e 69 6e 67 20 41 70 70 |by exami|ning App|
|00003560| 6c 4c 69 6d 69 74 2c 0d | 09 20 41 70 70 6c 69 63 |lLimit,.|. Applic|
|00003570| 5a 6f 6e 65 2c 20 61 6e | 64 20 53 74 61 63 6b 53 |Zone, an|d StackS|
|00003580| 70 61 63 65 20 61 6e 64 | 20 63 6f 6d 70 61 72 69 |pace and| compari|
|00003590| 6e 67 20 74 68 61 74 20 | 74 6f 20 74 68 65 20 6d |ng that |to the m|
|000035a0| 69 6e 69 6d 75 6d 20 73 | 69 7a 65 20 77 65 20 74 |inimum s|ize we t|
|000035b0| 6f 6c 64 0d 09 20 4d 75 | 6c 74 69 46 69 6e 64 65 |old.. Mu|ltiFinde|
|000035c0| 72 20 77 65 20 6e 65 65 | 64 65 64 2e 20 54 68 69 |r we nee|ded. Thi|
|000035d0| 73 20 64 69 64 20 6e 6f | 74 20 77 6f 72 6b 20 77 |s did no|t work w|
|000035e0| 65 6c 6c 20 62 65 63 61 | 75 73 65 20 69 74 20 61 |ell beca|use it a|
|000035f0| 73 73 75 6d 65 64 20 74 | 6f 6f 20 6d 75 63 68 20 |ssumed t|oo much |
|00003600| 61 62 6f 75 74 0d 09 20 | 74 68 65 20 72 65 6c 61 |about.. |the rela|
|00003610| 74 69 6f 6e 73 68 69 70 | 20 62 65 74 77 65 65 6e |tionship| between|
|00003620| 20 77 68 61 74 20 77 65 | 20 61 73 6b 65 64 20 4d | what we| asked M|
|00003630| 75 6c 74 69 46 69 6e 64 | 65 72 20 66 6f 72 20 61 |ultiFind|er for a|
|00003640| 6e 64 20 77 68 61 74 20 | 77 65 20 77 6f 75 6c 64 |nd what |we would|
|00003650| 20 61 63 74 75 61 6c 6c | 79 0d 09 20 67 65 74 20 | actuall|y.. get |
|00003660| 62 61 63 6b 2c 20 61 73 | 20 77 65 6c 6c 20 61 73 |back, as| well as|
|00003670| 20 68 6f 77 20 74 6f 20 | 6d 65 61 73 75 72 65 20 | how to |measure |
|00003680| 69 74 2e 20 49 6e 73 74 | 65 61 64 2c 20 77 65 20 |it. Inst|ead, we |
|00003690| 77 69 6c 6c 20 75 73 65 | 20 61 6e 20 61 6c 74 65 |will use| an alte|
|000036a0| 72 6e 61 74 65 0d 09 20 | 6d 65 74 68 6f 64 20 63 |rnate.. |method c|
|000036b0| 6f 6d 70 72 69 73 65 64 | 20 6f 66 20 74 77 6f 20 |omprised| of two |
|000036c0| 73 74 65 70 73 2e 7d 0d | 09 20 0d 09 7b 49 74 20 |steps.}.|. ..{It |
|000036d0| 69 73 20 62 65 74 74 65 | 72 20 74 6f 20 66 69 72 |is bette|r to fir|
|000036e0| 73 74 20 63 68 65 63 6b | 20 74 68 65 20 73 69 7a |st check| the siz|
|000036f0| 65 20 6f 66 20 74 68 65 | 20 61 70 70 6c 69 63 61 |e of the| applica|
|00003700| 74 69 6f 6e 20 68 65 61 | 70 20 61 67 61 69 6e 73 |tion hea|p agains|
|00003710| 74 20 61 20 76 61 6c 75 | 65 0d 09 20 74 68 61 74 |t a valu|e.. that|
|00003720| 20 79 6f 75 20 68 61 76 | 65 20 64 65 74 65 72 6d | you hav|e determ|
|00003730| 69 6e 65 64 20 69 73 20 | 74 68 65 20 73 6d 61 6c |ined is |the smal|
|00003740| 6c 65 73 74 20 68 65 61 | 70 20 74 68 65 20 61 70 |lest hea|p the ap|
|00003750| 70 6c 69 63 61 74 69 6f | 6e 20 63 61 6e 20 72 65 |plicatio|n can re|
|00003760| 61 73 6f 6e 61 62 6c 79 | 0d 09 20 77 6f 72 6b 20 |asonably|.. work |
|00003770| 69 6e 2e 20 54 68 69 73 | 20 6e 75 6d 62 65 72 20 |in. This| number |
|00003780| 73 68 6f 75 6c 64 20 62 | 65 20 64 65 72 69 76 65 |should b|e derive|
|00003790| 64 20 62 79 20 65 78 61 | 6d 69 6e 69 6e 67 20 74 |d by exa|mining t|
|000037a0| 68 65 20 73 69 7a 65 20 | 6f 66 20 74 68 65 20 68 |he size |of the h|
|000037b0| 65 61 70 20 74 68 61 74 | 0d 09 20 69 73 20 61 63 |eap that|.. is ac|
|000037c0| 74 75 61 6c 6c 79 20 70 | 72 6f 76 69 64 65 64 20 |tually p|rovided |
|000037d0| 62 79 20 4d 75 6c 74 69 | 46 69 6e 64 65 72 20 77 |by Multi|Finder w|
|000037e0| 68 65 6e 20 74 68 65 20 | 6d 69 6e 69 6d 75 6d 20 |hen the |minimum |
|000037f0| 73 69 7a 65 20 72 65 71 | 75 65 73 74 65 64 20 69 |size req|uested i|
|00003800| 73 20 75 73 65 64 2e 0d | 09 20 54 68 65 20 64 65 |s used..|. The de|
|00003810| 72 69 76 61 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |rivation| of the |
|00003820| 6d 69 6e 69 6d 75 6d 20 | 73 69 7a 65 20 72 65 71 |minimum |size req|
|00003830| 75 65 73 74 65 64 20 66 | 72 6f 6d 20 4d 75 6c 74 |uested f|rom Mult|
|00003840| 69 46 69 6e 64 65 72 20 | 69 73 20 64 65 73 63 72 |iFinder |is descr|
|00003850| 69 62 65 64 0d 09 20 69 | 6e 20 53 61 6d 70 6c 65 |ibed.. i|n Sample|
|00003860| 2e 68 2e 20 54 68 65 20 | 63 68 65 63 6b 20 73 68 |.h. The |check sh|
|00003870| 6f 75 6c 64 20 62 65 20 | 6d 61 64 65 20 62 65 63 |ould be |made bec|
|00003880| 61 75 73 65 20 74 68 65 | 20 70 72 65 66 65 72 72 |ause the| preferr|
|00003890| 65 64 20 73 69 7a 65 20 | 63 61 6e 20 65 6e 64 20 |ed size |can end |
|000038a0| 75 70 0d 09 20 62 65 69 | 6e 67 20 73 65 74 20 73 |up.. bei|ng set s|
|000038b0| 6d 61 6c 6c 65 72 20 74 | 68 61 6e 20 74 68 65 20 |maller t|han the |
|000038c0| 6d 69 6e 69 6d 75 6d 20 | 73 69 7a 65 20 62 79 20 |minimum |size by |
|000038d0| 74 68 65 20 75 73 65 72 | 2e 20 54 68 69 73 20 65 |the user|. This e|
|000038e0| 78 74 72 61 20 63 68 65 | 63 6b 20 61 63 74 73 20 |xtra che|ck acts |
|000038f0| 74 6f 0d 09 20 69 6e 73 | 75 72 65 20 74 68 61 74 |to.. ins|ure that|
|00003900| 20 79 6f 75 72 20 61 70 | 70 6c 69 63 61 74 69 6f | your ap|plicatio|
|00003910| 6e 20 69 73 20 73 74 61 | 72 74 69 6e 67 20 66 72 |n is sta|rting fr|
|00003920| 6f 6d 20 61 20 73 6f 6c | 69 64 20 6d 65 6d 6f 72 |om a sol|id memor|
|00003930| 79 20 66 6f 75 6e 64 61 | 74 69 6f 6e 2e 7d 0d 09 |y founda|tion.}..|
|00003940| 20 0d 09 49 46 20 4f 52 | 44 28 47 65 74 41 70 70 | ..IF OR|D(GetApp|
|00003950| 6c 4c 69 6d 69 74 29 20 | 2d 20 4f 52 44 28 41 70 |lLimit) |- ORD(Ap|
|00003960| 70 6c 69 63 5a 6f 6e 65 | 29 20 3c 20 6b 4d 69 6e |plicZone|) < kMin|
|00003970| 48 65 61 70 20 54 48 45 | 4e 20 41 6c 65 72 74 55 |Heap THE|N AlertU|
|00003980| 73 65 72 3b 0d 09 0d 09 | 7b 4e 65 78 74 2c 20 6d |ser;....|{Next, m|
|00003990| 61 6b 65 20 73 75 72 65 | 20 74 68 61 74 20 65 6e |ake sure| that en|
|000039a0| 6f 75 67 68 20 6d 65 6d | 6f 72 79 20 69 73 20 66 |ough mem|ory is f|
|000039b0| 72 65 65 20 66 6f 72 20 | 79 6f 75 72 20 61 70 70 |ree for |your app|
|000039c0| 6c 69 63 61 74 69 6f 6e | 20 74 6f 20 72 75 6e 2e |lication| to run.|
|000039d0| 20 49 74 0d 09 20 69 73 | 20 70 6f 73 73 69 62 6c | It.. is| possibl|
|000039e0| 65 20 66 6f 72 20 61 20 | 73 69 74 75 61 74 69 6f |e for a |situatio|
|000039f0| 6e 20 74 6f 20 61 72 69 | 73 65 20 77 68 65 72 65 |n to ari|se where|
|00003a00| 20 74 68 65 20 68 65 61 | 70 20 6d 61 79 20 68 61 | the hea|p may ha|
|00003a10| 76 65 20 62 65 65 6e 20 | 6f 66 20 72 65 71 75 69 |ve been |of requi|
|00003a20| 72 65 64 0d 09 20 73 69 | 7a 65 2c 20 62 75 74 20 |red.. si|ze, but |
|00003a30| 61 20 6c 61 72 67 65 20 | 73 63 72 61 70 20 77 61 |a large |scrap wa|
|00003a40| 73 20 6c 6f 61 64 65 64 | 20 77 68 69 63 68 20 6c |s loaded| which l|
|00003a50| 65 66 74 20 74 6f 6f 20 | 6c 69 74 74 6c 65 20 6d |eft too |little m|
|00003a60| 65 6d 6f 72 79 2e 20 54 | 6f 20 63 68 65 63 6b 20 |emory. T|o check |
|00003a70| 66 6f 72 0d 09 20 74 68 | 69 73 2c 20 63 61 6c 6c |for.. th|is, call|
|00003a80| 20 50 75 72 67 65 53 70 | 61 63 65 20 61 6e 64 20 | PurgeSp|ace and |
|00003a90| 63 6f 6d 70 61 72 65 20 | 74 68 65 20 72 65 73 75 |compare |the resu|
|00003aa0| 6c 74 20 77 69 74 68 20 | 61 20 76 61 6c 75 65 20 |lt with |a value |
|00003ab0| 74 68 61 74 20 79 6f 75 | 20 68 61 76 65 20 64 65 |that you| have de|
|00003ac0| 74 65 72 6d 69 6e 65 64 | 0d 09 20 69 73 20 74 68 |termined|.. is th|
|00003ad0| 65 20 6d 69 6e 69 6d 75 | 6d 20 61 6d 6f 75 6e 74 |e minimu|m amount|
|00003ae0| 20 6f 66 20 66 72 65 65 | 20 6d 65 6d 6f 72 79 20 | of free| memory |
|00003af0| 79 6f 75 72 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |your app|lication|
|00003b00| 20 6e 65 65 64 73 20 61 | 74 20 69 6e 69 74 69 61 | needs a|t initia|
|00003b10| 6c 69 7a 61 74 69 6f 6e | 2e 0d 09 20 54 68 69 73 |lization|... This|
|00003b20| 20 6e 75 6d 62 65 72 20 | 63 61 6e 20 62 65 20 64 | number |can be d|
|00003b30| 65 72 69 76 65 64 20 73 | 65 76 65 72 61 6c 20 64 |erived s|everal d|
|00003b40| 69 66 66 65 72 65 6e 74 | 20 77 61 79 73 2e 20 4f |ifferent| ways. O|
|00003b50| 6e 65 20 77 61 79 20 74 | 68 61 74 20 69 73 20 66 |ne way t|hat is f|
|00003b60| 61 69 72 6c 79 0d 09 20 | 73 74 72 61 69 67 68 74 |airly.. |straight|
|00003b70| 66 6f 72 77 61 72 64 20 | 69 73 20 74 6f 20 72 75 |forward |is to ru|
|00003b80| 6e 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |n the ap|plicatio|
|00003b90| 6e 20 69 6e 20 74 68 65 | 20 6d 69 6e 69 6d 75 6d |n in the| minimum|
|00003ba0| 20 73 69 7a 65 20 63 6f | 6e 66 69 67 75 72 61 74 | size co|nfigurat|
|00003bb0| 69 6f 6e 0d 09 20 61 73 | 20 64 65 73 63 72 69 62 |ion.. as| describ|
|00003bc0| 65 64 20 70 72 65 76 69 | 6f 75 73 6c 79 2e 20 43 |ed previ|ously. C|
|00003bd0| 61 6c 6c 20 50 75 72 67 | 65 53 70 61 63 65 20 61 |all Purg|eSpace a|
|00003be0| 74 20 69 6e 69 74 69 61 | 6c 69 7a 61 74 69 6f 6e |t initia|lization|
|00003bf0| 20 61 6e 64 20 65 78 61 | 6d 69 6e 65 20 74 68 65 | and exa|mine the|
|00003c00| 20 76 61 6c 75 65 0d 09 | 20 72 65 74 75 72 6e 65 | value..| returne|
|00003c10| 64 2e 20 48 6f 77 65 76 | 65 72 2c 20 79 6f 75 20 |d. Howev|er, you |
|00003c20| 73 68 6f 75 6c 64 20 6d | 61 6b 65 20 73 75 72 65 |should m|ake sure|
|00003c30| 20 74 68 61 74 20 74 68 | 69 73 20 72 65 73 75 6c | that th|is resul|
|00003c40| 74 20 69 73 20 6e 6f 74 | 20 62 65 69 6e 67 20 6d |t is not| being m|
|00003c50| 6f 64 69 66 69 65 64 0d | 09 20 62 79 20 74 68 65 |odified.|. by the|
|00003c60| 20 73 63 72 61 70 27 73 | 20 70 72 65 73 65 6e 63 | scrap's| presenc|
|00003c70| 65 2e 20 59 6f 75 20 63 | 61 6e 20 64 6f 20 74 68 |e. You c|an do th|
|00003c80| 61 74 20 62 79 20 63 61 | 6c 6c 69 6e 67 20 5a 65 |at by ca|lling Ze|
|00003c90| 72 6f 53 63 72 61 70 20 | 62 65 66 6f 72 65 20 63 |roScrap |before c|
|00003ca0| 61 6c 6c 69 6e 67 0d 09 | 20 50 75 72 67 65 53 70 |alling..| PurgeSp|
|00003cb0| 61 63 65 2e 20 4d 61 6b | 65 20 73 75 72 65 20 74 |ace. Mak|e sure t|
|00003cc0| 6f 20 72 65 6d 6f 76 65 | 20 74 68 61 74 20 63 61 |o remove| that ca|
|00003cd0| 6c 6c 20 62 65 66 6f 72 | 65 20 73 68 69 70 70 69 |ll befor|e shippi|
|00003ce0| 6e 67 2c 20 74 68 6f 75 | 67 68 2e 7d 0d 09 20 0d |ng, thou|gh.}.. .|
|00003cf0| 09 50 75 72 67 65 53 70 | 61 63 65 28 74 6f 74 61 |.PurgeSp|ace(tota|
|00003d00| 6c 2c 20 63 6f 6e 74 69 | 67 29 3b 0d 09 49 46 20 |l, conti|g);..IF |
|00003d10| 74 6f 74 61 6c 20 3c 20 | 6b 4d 69 6e 53 70 61 63 |total < |kMinSpac|
|00003d20| 65 20 54 48 45 4e 20 41 | 6c 65 72 74 55 73 65 72 |e THEN A|lertUser|
|00003d30| 3b 0d 0d 09 7b 54 68 65 | 20 65 78 74 72 61 20 62 |;...{The| extra b|
|00003d40| 65 6e 65 66 69 74 20 74 | 6f 20 77 61 69 74 6e 67 |enefit t|o waitng|
|00003d50| 20 75 6e 74 69 6c 20 61 | 66 74 65 72 20 74 68 65 | until a|fter the|
|00003d60| 20 54 6f 6f 6c 62 6f 78 | 20 4d 61 6e 61 67 65 72 | Toolbox| Manager|
|00003d70| 73 20 68 61 76 65 20 62 | 65 65 6e 20 69 6e 69 74 |s have b|een init|
|00003d80| 69 61 6c 69 7a 65 64 0d | 09 20 62 65 66 6f 72 65 |ialized.|. before|
|00003d90| 20 63 68 65 63 6b 69 6e | 67 20 6d 65 6d 6f 72 79 | checkin|g memory|
|00003da0| 20 69 73 20 74 68 61 74 | 20 77 65 20 63 61 6e 20 | is that| we can |
|00003db0| 6e 6f 77 20 67 69 76 65 | 20 74 68 65 20 75 73 65 |now give| the use|
|00003dc0| 72 20 61 6e 20 61 6c 65 | 72 74 20 74 6f 20 74 65 |r an ale|rt to te|
|00003dd0| 6c 6c 20 68 69 6d 20 77 | 68 61 74 0d 09 20 68 61 |ll him w|hat.. ha|
|00003de0| 70 70 65 6e 65 64 2e 20 | 41 6c 74 68 6f 75 67 68 |ppened. |Although|
|00003df0| 20 69 74 20 69 73 20 70 | 6f 73 73 69 62 6c 65 20 | it is p|ossible |
|00003e00| 74 68 61 74 20 74 68 65 | 20 6d 65 6d 6f 72 79 20 |that the| memory |
|00003e10| 73 69 74 75 61 74 69 6f | 6e 20 63 6f 75 6c 64 20 |situatio|n could |
|00003e20| 62 65 20 77 6f 72 73 65 | 6e 65 64 20 62 79 0d 09 |be worse|ned by..|
|00003e30| 20 64 69 73 70 6c 61 79 | 69 6e 67 20 61 6e 20 61 | display|ing an a|
|00003e40| 6c 65 72 74 2c 20 4d 75 | 6c 74 69 46 69 6e 64 65 |lert, Mu|ltiFinde|
|00003e50| 72 20 77 6f 75 6c 64 20 | 67 72 61 63 65 66 75 6c |r would |graceful|
|00003e60| 6c 79 20 65 78 69 74 20 | 74 68 65 20 61 70 70 6c |ly exit |the appl|
|00003e70| 69 63 61 74 69 6f 6e 20 | 77 69 74 68 0d 09 20 61 |ication |with.. a|
|00003e80| 6e 20 69 6e 66 6f 72 6d | 61 74 69 76 65 20 61 6c |n inform|ative al|
|00003e90| 65 72 74 20 69 66 20 6d | 65 6d 6f 72 79 20 62 65 |ert if m|emory be|
|00003ea0| 63 61 6d 65 20 63 72 69 | 74 69 63 61 6c 2e 20 48 |came cri|tical. H|
|00003eb0| 65 72 65 20 77 65 20 61 | 72 65 20 61 63 74 69 6e |ere we a|re actin|
|00003ec0| 67 20 6d 6f 72 65 0d 09 | 20 69 6e 20 61 20 70 72 |g more..| in a pr|
|00003ed0| 65 76 65 6e 74 61 74 69 | 76 65 20 6d 61 6e 6e 65 |eventati|ve manne|
|00003ee0| 72 20 74 6f 20 61 76 6f | 69 64 20 66 75 74 75 72 |r to avo|id futur|
|00003ef0| 65 20 64 69 73 61 73 74 | 65 72 20 66 72 6f 6d 20 |e disast|er from |
|00003f00| 6c 6f 77 2d 6d 65 6d 6f | 72 79 20 70 72 6f 62 6c |low-memo|ry probl|
|00003f10| 65 6d 73 2e 7d 0d 09 20 | 0d 09 7b 57 65 20 77 69 |ems.}.. |..{We wi|
|00003f20| 6c 6c 20 61 6c 6c 6f 63 | 61 74 65 20 6f 75 72 20 |ll alloc|ate our |
|00003f30| 6f 77 6e 20 77 69 6e 64 | 6f 77 20 73 74 6f 72 61 |own wind|ow stora|
|00003f40| 67 65 20 69 6e 73 74 65 | 61 64 20 6f 66 20 6c 65 |ge inste|ad of le|
|00003f50| 74 74 69 6e 67 20 74 68 | 65 20 57 69 6e 64 6f 77 |tting th|e Window|
|00003f60| 0d 09 20 4d 61 6e 61 67 | 65 72 20 66 6f 72 20 74 |.. Manag|er for t|
|00003f70| 77 6f 20 72 65 61 73 6f | 6e 73 2e 20 4f 6e 65 2c |wo reaso|ns. One,|
|00003f80| 20 47 65 74 4e 65 77 57 | 69 6e 64 6f 77 20 6c 6f | GetNewW|indow lo|
|00003f90| 63 6b 73 20 74 68 65 20 | 27 57 49 4e 44 27 20 72 |cks the |'WIND' r|
|00003fa0| 65 73 6f 75 72 63 65 0d | 09 20 68 61 6e 64 6c 65 |esource.|. handle|
|00003fb0| 20 62 65 66 6f 72 65 20 | 63 61 6c 6c 69 6e 67 20 | before |calling |
|00003fc0| 4e 65 77 57 69 6e 64 6f | 77 20 61 6e 64 20 74 68 |NewWindo|w and th|
|00003fd0| 69 73 20 63 61 6e 20 6c | 65 61 64 20 74 6f 20 68 |is can l|ead to h|
|00003fe0| 65 61 70 20 66 72 61 67 | 6d 65 6e 74 61 74 69 6f |eap frag|mentatio|
|00003ff0| 6e 2e 0d 09 20 54 77 6f | 2c 20 69 74 20 74 61 6b |n... Two|, it tak|
|00004000| 65 73 20 6a 75 73 74 20 | 61 73 20 6d 75 63 68 20 |es just |as much |
|00004010| 74 69 6d 65 20 66 6f 72 | 20 4e 65 77 57 69 6e 64 |time for| NewWind|
|00004020| 6f 77 20 74 6f 20 67 65 | 74 20 74 68 65 20 6d 65 |ow to ge|t the me|
|00004030| 6d 6f 72 79 20 61 73 20 | 69 74 0d 09 20 64 6f 65 |mory as |it.. doe|
|00004040| 73 20 66 6f 72 20 75 73 | 20 74 6f 20 67 65 74 20 |s for us| to get |
|00004050| 69 74 2e 7d 0d 0d 09 77 | 69 6e 64 6f 77 20 3a 3d |it.}...w|indow :=|
|00004060| 20 57 69 6e 64 6f 77 50 | 74 72 28 4e 65 77 50 74 | WindowP|tr(NewPt|
|00004070| 72 28 53 49 5a 45 4f 46 | 28 57 69 6e 64 6f 77 52 |r(SIZEOF|(WindowR|
|00004080| 65 63 6f 72 64 29 29 29 | 3b 0d 09 49 46 20 77 69 |ecord)))|;..IF wi|
|00004090| 6e 64 6f 77 20 3d 20 4e | 49 4c 20 54 48 45 4e 20 |ndow = N|IL THEN |
|000040a0| 41 6c 65 72 74 55 73 65 | 72 3b 0d 09 77 69 6e 64 |AlertUse|r;..wind|
|000040b0| 6f 77 20 3a 3d 20 47 65 | 74 4e 65 77 57 69 6e 64 |ow := Ge|tNewWind|
|000040c0| 6f 77 28 72 57 69 6e 64 | 6f 77 2c 20 50 74 72 28 |ow(rWind|ow, Ptr(|
|000040d0| 77 69 6e 64 6f 77 29 2c | 20 57 69 6e 64 6f 77 50 |window),| WindowP|
|000040e0| 74 72 28 2d 31 29 29 3b | 0d 0d 09 6d 65 6e 75 42 |tr(-1));|...menuB|
|000040f0| 61 72 20 3a 3d 20 47 65 | 74 4e 65 77 4d 42 61 72 |ar := Ge|tNewMBar|
|00004100| 28 72 4d 65 6e 75 42 61 | 72 29 3b 09 09 7b 72 65 |(rMenuBa|r);..{re|
|00004110| 61 64 20 6d 65 6e 75 73 | 20 69 6e 74 6f 20 6d 65 |ad menus| into me|
|00004120| 6e 75 20 62 61 72 7d 0d | 09 49 46 20 6d 65 6e 75 |nu bar}.|.IF menu|
|00004130| 42 61 72 20 3d 20 4e 49 | 4c 20 54 48 45 4e 20 41 |Bar = NI|L THEN A|
|00004140| 6c 65 72 74 55 73 65 72 | 3b 0d 09 53 65 74 4d 65 |lertUser|;..SetMe|
|00004150| 6e 75 42 61 72 28 6d 65 | 6e 75 42 61 72 29 3b 09 |nuBar(me|nuBar);.|
|00004160| 09 09 09 09 7b 69 6e 73 | 74 61 6c 6c 20 6d 65 6e |....{ins|tall men|
|00004170| 75 73 7d 0d 09 44 69 73 | 70 6f 73 48 61 6e 64 6c |us}..Dis|posHandl|
|00004180| 65 28 6d 65 6e 75 42 61 | 72 29 3b 0d 09 41 64 64 |e(menuBa|r);..Add|
|00004190| 52 65 73 4d 65 6e 75 28 | 47 65 74 4d 48 61 6e 64 |ResMenu(|GetMHand|
|000041a0| 6c 65 28 6d 41 70 70 6c | 65 29 2c 20 27 44 52 56 |le(mAppl|e), 'DRV|
|000041b0| 52 27 29 3b 09 7b 61 64 | 64 20 44 41 20 6e 61 6d |R');.{ad|d DA nam|
|000041c0| 65 73 20 74 6f 20 41 70 | 70 6c 65 20 6d 65 6e 75 |es to Ap|ple menu|
|000041d0| 7d 0d 09 44 72 61 77 4d | 65 6e 75 42 61 72 3b 0d |}..DrawM|enuBar;.|
|000041e0| 0d 09 67 53 74 6f 70 70 | 65 64 20 3a 3d 20 54 52 |..gStopp|ed := TR|
|000041f0| 55 45 3b 0d 09 49 46 20 | 4e 4f 54 20 47 6f 47 65 |UE;..IF |NOT GoGe|
|00004200| 74 52 65 63 74 28 72 53 | 74 6f 70 52 65 63 74 2c |tRect(rS|topRect,|
|00004210| 20 67 53 74 6f 70 52 65 | 63 74 29 20 54 48 45 4e | gStopRe|ct) THEN|
|00004220| 0d 09 09 41 6c 65 72 74 | 55 73 65 72 3b 09 09 09 |...Alert|User;...|
|00004230| 09 09 09 09 7b 74 68 65 | 20 73 74 6f 70 20 6c 69 |....{the| stop li|
|00004240| 67 68 74 20 72 65 63 74 | 61 6e 67 6c 65 7d 0d 09 |ght rect|angle}..|
|00004250| 49 46 20 4e 4f 54 20 47 | 6f 47 65 74 52 65 63 74 |IF NOT G|oGetRect|
|00004260| 28 72 47 6f 52 65 63 74 | 2c 20 67 47 6f 52 65 63 |(rGoRect|, gGoRec|
|00004270| 74 29 20 54 48 45 4e 0d | 09 09 41 6c 65 72 74 55 |t) THEN.|..AlertU|
|00004280| 73 65 72 3b 09 09 09 09 | 09 09 09 7b 74 68 65 20 |ser;....|...{the |
|00004290| 67 6f 20 6c 69 67 68 74 | 20 72 65 63 74 61 6e 67 |go light| rectang|
|000042a0| 6c 65 7d 0d 45 4e 44 3b | 20 7b 49 6e 69 74 69 61 |le}.END;| {Initia|
|000042b0| 6c 69 7a 65 7d 0d 0d 0d | 28 2a 2a 2a 2a 2a 2a 2a |lize}...|(*******|
|000042c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000042d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000042e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000042f0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004300| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 0d |********|*******.|
|00004310| 31 2e 30 31 20 2d 20 50 | 52 4f 43 45 44 55 52 45 |1.01 - P|ROCEDURE|
|00004320| 20 44 6f 43 6c 6f 73 65 | 42 65 68 69 6e 64 28 77 | DoClose|Behind(w|
|00004330| 69 6e 64 6f 77 3a 20 57 | 69 6e 64 6f 77 50 74 72 |indow: W|indowPtr|
|00004340| 29 3b 20 77 61 73 20 72 | 65 6d 6f 76 65 64 2e 0d |); was r|emoved..|
|00004350| 0d 7b 31 2e 30 31 20 2d | 20 44 6f 43 6c 6f 73 65 |.{1.01 -| DoClose|
|00004360| 42 65 68 69 6e 64 20 77 | 61 73 20 61 20 67 6f 6f |Behind w|as a goo|
|00004370| 64 20 69 64 65 61 20 66 | 6f 72 20 63 6c 6f 73 69 |d idea f|or closi|
|00004380| 6e 67 20 77 69 6e 64 6f | 77 73 20 77 68 65 6e 20 |ng windo|ws when |
|00004390| 71 75 69 74 74 69 6e 67 | 0d 20 61 6e 64 20 6e 6f |quitting|. and no|
|000043a0| 74 20 68 61 76 69 6e 67 | 20 74 6f 20 77 6f 72 72 |t having| to worr|
|000043b0| 79 20 61 62 6f 75 74 20 | 75 70 64 61 74 69 6e 67 |y about |updating|
|000043c0| 20 74 68 65 20 77 69 6e | 64 6f 77 73 2c 20 62 75 | the win|dows, bu|
|000043d0| 74 20 69 74 20 73 75 66 | 66 65 72 65 64 0d 20 66 |t it suf|fered. f|
|000043e0| 72 6f 6d 20 61 20 66 61 | 74 61 6c 20 66 6c 61 77 |rom a fa|tal flaw|
|000043f0| 2e 20 49 66 20 61 20 64 | 65 73 6b 20 61 63 63 65 |. If a d|esk acce|
|00004400| 73 73 6f 72 79 20 6f 77 | 6e 65 64 20 74 77 6f 20 |ssory ow|ned two |
|00004410| 77 69 6e 64 6f 77 73 2c | 20 69 74 20 77 6f 75 6c |windows,| it woul|
|00004420| 64 0d 20 63 6c 6f 73 65 | 20 62 6f 74 68 20 74 68 |d. close| both th|
|00004430| 6f 73 65 20 77 69 6e 64 | 6f 77 73 20 77 68 65 6e |ose wind|ows when|
|00004440| 20 43 6c 6f 73 65 44 65 | 73 6b 41 63 63 20 77 61 | CloseDe|skAcc wa|
|00004450| 73 20 63 61 6c 6c 65 64 | 2e 20 57 68 65 6e 20 44 |s called|. When D|
|00004460| 6f 43 6c 6f 73 65 42 65 | 68 69 6e 64 0d 20 67 6f |oCloseBe|hind. go|
|00004470| 74 20 61 72 6f 75 6e 64 | 20 74 6f 20 63 61 6c 6c |t around| to call|
|00004480| 69 6e 67 20 44 6f 43 6c | 6f 73 65 57 69 6e 64 6f |ing DoCl|oseWindo|
|00004490| 77 20 66 6f 72 20 74 68 | 61 74 20 6f 74 68 65 72 |w for th|at other|
|000044a0| 20 77 69 6e 64 6f 77 20 | 74 68 61 74 20 77 61 73 | window |that was|
|000044b0| 20 61 6c 72 65 61 64 79 | 0d 20 63 6c 6f 73 65 64 | already|. closed|
|000044c0| 2c 20 74 68 69 6e 67 73 | 20 77 6f 75 6c 64 20 67 |, things| would g|
|000044d0| 6f 20 76 65 72 79 20 70 | 6f 6f 72 6c 79 2e 20 41 |o very p|oorly. A|
|000044e0| 6e 6f 74 68 65 72 20 6f | 70 74 69 6f 6e 20 77 6f |nother o|ption wo|
|000044f0| 75 6c 64 20 62 65 20 74 | 6f 20 68 61 76 65 20 61 |uld be t|o have a|
|00004500| 0d 20 70 72 6f 63 65 64 | 75 72 65 2c 20 47 65 74 |. proced|ure, Get|
|00004510| 52 65 61 72 57 69 6e 64 | 6f 77 2c 20 74 68 61 74 |RearWind|ow, that|
|00004520| 20 77 6f 75 6c 64 20 67 | 6f 20 74 68 72 6f 75 67 | would g|o throug|
|00004530| 68 20 74 68 65 20 77 69 | 6e 64 6f 77 20 6c 69 73 |h the wi|ndow lis|
|00004540| 74 20 61 6e 64 20 72 65 | 74 75 72 6e 0d 20 74 68 |t and re|turn. th|
|00004550| 65 20 6c 61 73 74 20 77 | 69 6e 64 6f 77 2e 20 49 |e last w|indow. I|
|00004560| 6e 73 74 65 61 64 2c 20 | 77 65 20 64 65 63 69 64 |nstead, |we decid|
|00004570| 65 64 20 74 6f 20 70 72 | 65 73 65 6e 74 20 74 68 |ed to pr|esent th|
|00004580| 65 20 73 74 61 6e 64 61 | 72 64 20 61 70 70 72 6f |e standa|rd appro|
|00004590| 61 63 68 0d 20 6f 66 20 | 67 65 74 74 69 6e 67 20 |ach. of |getting |
|000045a0| 61 6e 64 20 63 6c 6f 73 | 69 6e 67 20 46 72 6f 6e |and clos|ing Fron|
|000045b0| 74 57 69 6e 64 6f 77 20 | 75 6e 74 69 6c 20 46 72 |tWindow |until Fr|
|000045c0| 6f 6e 74 57 69 6e 64 6f | 77 20 72 65 74 75 72 6e |ontWindo|w return|
|000045d0| 73 20 4e 49 4c 2e 20 54 | 68 69 73 0d 20 68 61 73 |s NIL. T|his. has|
|000045e0| 20 61 20 70 6f 74 65 6e | 74 69 61 6c 20 62 65 6e | a poten|tial ben|
|000045f0| 65 66 69 74 20 69 6e 20 | 74 68 61 74 20 74 68 65 |efit in |that the|
|00004600| 20 77 69 6e 64 6f 77 20 | 77 68 6f 73 65 20 64 6f | window |whose do|
|00004610| 63 75 6d 65 6e 74 20 6e | 65 65 64 73 20 74 6f 20 |cument n|eeds to |
|00004620| 62 65 20 73 61 76 65 64 | 0d 20 6d 61 79 20 62 65 |be saved|. may be|
|00004630| 20 76 69 73 69 62 6c 65 | 20 73 69 6e 63 65 20 69 | visible| since i|
|00004640| 74 20 69 73 20 74 68 65 | 20 66 72 6f 6e 74 20 77 |t is the| front w|
|00004650| 69 6e 64 6f 77 2c 20 74 | 68 65 72 65 66 6f 72 65 |indow, t|herefore|
|00004660| 20 64 65 63 72 65 61 73 | 69 6e 67 20 74 68 65 0d | decreas|ing the.|
|00004670| 20 63 68 61 6e 63 65 20 | 6f 66 20 75 73 65 72 20 | chance |of user |
|00004680| 63 6f 6e 66 75 73 69 6f | 6e 2e 20 46 6f 72 20 61 |confusio|n. For a|
|00004690| 65 73 74 68 65 74 69 63 | 20 72 65 61 73 6f 6e 73 |esthetic| reasons|
|000046a0| 2c 20 74 68 65 20 77 69 | 6e 64 6f 77 73 20 69 6e |, the wi|ndows in|
|000046b0| 20 74 68 65 0d 20 61 70 | 70 6c 69 63 61 74 69 6f | the. ap|plicatio|
|000046c0| 6e 20 73 68 6f 75 6c 64 | 20 62 65 20 63 68 65 63 |n should| be chec|
|000046d0| 6b 65 64 20 66 6f 72 20 | 75 70 64 61 74 65 73 20 |ked for |updates |
|000046e0| 70 65 72 69 6f 64 69 63 | 61 6c 6c 79 20 61 6e 64 |periodic|ally and|
|000046f0| 20 68 61 76 65 20 74 68 | 65 0d 20 75 70 64 61 74 | have th|e. updat|
|00004700| 65 73 20 73 65 72 76 69 | 63 65 64 2e 7d 0d 2a 2a |es servi|ced.}.**|
|00004710| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004720| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004730| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004740| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004750| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004760| 2a 2a 2a 2a 29 0d 0d 0d | 7b 24 53 20 4d 61 69 6e |****)...|{$S Main|
|00004770| 7d 0d 50 52 4f 43 45 44 | 55 52 45 20 54 65 72 6d |}.PROCED|URE Term|
|00004780| 69 6e 61 74 65 3b 0d 0d | 7b 43 6c 65 61 6e 20 75 |inate;..|{Clean u|
|00004790| 70 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |p the ap|plicatio|
|000047a0| 6e 20 61 6e 64 20 65 78 | 69 74 73 2e 20 57 65 20 |n and ex|its. We |
|000047b0| 63 6c 6f 73 65 20 61 6c | 6c 20 6f 66 20 74 68 65 |close al|l of the|
|000047c0| 20 77 69 6e 64 6f 77 73 | 20 73 6f 20 74 68 61 74 | windows| so that|
|000047d0| 0d 20 74 68 65 79 20 63 | 61 6e 20 75 70 64 61 74 |. they c|an updat|
|000047e0| 65 20 74 68 65 69 72 20 | 64 6f 63 75 6d 65 6e 74 |e their |document|
|000047f0| 73 2c 20 69 66 20 61 6e | 79 2e 7d 0d 20 0d 7b 31 |s, if an|y.}. .{1|
|00004800| 2e 30 31 20 2d 20 49 66 | 20 77 65 20 66 69 6e 64 |.01 - If| we find|
|00004810| 20 6f 75 74 20 74 68 61 | 74 20 61 20 63 61 6e 63 | out tha|t a canc|
|00004820| 65 6c 20 68 61 73 20 6f | 63 63 75 72 72 65 64 2c |el has o|ccurred,|
|00004830| 20 77 65 20 77 6f 6e 27 | 74 20 65 78 69 74 20 74 | we won'|t exit t|
|00004840| 6f 20 74 68 65 0d 20 73 | 68 65 6c 6c 2c 20 62 75 |o the. s|hell, bu|
|00004850| 74 20 77 69 6c 6c 20 72 | 65 74 75 72 6e 20 69 6e |t will r|eturn in|
|00004860| 73 74 65 61 64 2e 7d 0d | 20 0d 56 41 52 0d 09 61 |stead.}.| .VAR..a|
|00004870| 57 69 6e 64 6f 77 09 3a | 20 57 69 6e 64 6f 77 50 |Window.:| WindowP|
|00004880| 74 72 3b 0d 09 63 6c 6f | 73 65 64 09 3a 20 42 4f |tr;..clo|sed.: BO|
|00004890| 4f 4c 45 41 4e 3b 0d 0d | 42 45 47 49 4e 0d 09 63 |OLEAN;..|BEGIN..c|
|000048a0| 6c 6f 73 65 64 20 3a 3d | 20 54 52 55 45 3b 0d 09 |losed :=| TRUE;..|
|000048b0| 52 45 50 45 41 54 0d 09 | 09 61 57 69 6e 64 6f 77 |REPEAT..|.aWindow|
|000048c0| 20 3a 3d 20 46 72 6f 6e | 74 57 69 6e 64 6f 77 3b | := Fron|tWindow;|
|000048d0| 09 09 09 09 09 7b 67 65 | 74 20 74 68 65 20 63 75 |.....{ge|t the cu|
|000048e0| 72 72 65 6e 74 20 66 72 | 6f 6e 74 20 77 69 6e 64 |rrent fr|ont wind|
|000048f0| 6f 77 7d 0d 09 09 49 46 | 20 61 57 69 6e 64 6f 77 |ow}...IF| aWindow|
|00004900| 20 3c 3e 20 4e 49 4c 20 | 54 48 45 4e 0d 09 09 09 | <> NIL |THEN....|
|00004910| 63 6c 6f 73 65 64 20 3a | 3d 20 44 6f 43 6c 6f 73 |closed :|= DoClos|
|00004920| 65 57 69 6e 64 6f 77 28 | 61 57 69 6e 64 6f 77 29 |eWindow(|aWindow)|
|00004930| 3b 09 7b 63 6c 6f 73 65 | 20 74 68 69 73 20 77 69 |;.{close| this wi|
|00004940| 6e 64 6f 77 7d 0d 09 55 | 4e 54 49 4c 20 28 4e 4f |ndow}..U|NTIL (NO|
|00004950| 54 20 63 6c 6f 73 65 64 | 29 20 7c 20 28 61 57 69 |T closed|) | (aWi|
|00004960| 6e 64 6f 77 20 3d 20 4e | 49 4c 29 3b 09 09 7b 64 |ndow = N|IL);..{d|
|00004970| 6f 20 61 6c 6c 20 77 69 | 6e 64 6f 77 73 7d 0d 09 |o all wi|ndows}..|
|00004980| 49 46 20 63 6c 6f 73 65 | 64 20 54 48 45 4e 0d 09 |IF close|d THEN..|
|00004990| 09 45 78 69 74 54 6f 53 | 68 65 6c 6c 3b 09 09 09 |.ExitToS|hell;...|
|000049a0| 09 09 09 09 7b 65 78 69 | 74 20 69 66 20 6e 6f 20 |....{exi|t if no |
|000049b0| 63 61 6e 63 65 6c 6c 61 | 74 69 6f 6e 7d 0d 45 4e |cancella|tion}.EN|
|000049c0| 44 3b 20 7b 54 65 72 6d | 69 6e 61 74 65 7d 0d 0d |D; {Term|inate}..|
|000049d0| 0d 7b 24 53 20 4d 61 69 | 6e 7d 0d 50 52 4f 43 45 |.{$S Mai|n}.PROCE|
|000049e0| 44 55 52 45 20 53 65 74 | 4c 69 67 68 74 28 77 69 |DURE Set|Light(wi|
|000049f0| 6e 64 6f 77 3a 20 57 69 | 6e 64 6f 77 50 74 72 3b |ndow: Wi|ndowPtr;|
|00004a00| 20 6e 65 77 53 74 6f 70 | 70 65 64 3a 20 42 4f 4f | newStop|ped: BOO|
|00004a10| 4c 45 41 4e 29 3b 0d 0d | 7b 43 68 61 6e 67 65 20 |LEAN);..|{Change |
|00004a20| 74 68 65 20 73 65 74 74 | 69 6e 67 20 6f 66 20 74 |the sett|ing of t|
|00004a30| 68 65 20 6c 69 67 68 74 | 2e 7d 0d 0d 42 45 47 49 |he light|.}..BEGI|
|00004a40| 4e 0d 09 49 46 20 6e 65 | 77 53 74 6f 70 70 65 64 |N..IF ne|wStopped|
|00004a50| 20 3c 3e 20 67 53 74 6f | 70 70 65 64 20 54 48 45 | <> gSto|pped THE|
|00004a60| 4e 20 42 45 47 49 4e 0d | 09 09 67 53 74 6f 70 70 |N BEGIN.|..gStopp|
|00004a70| 65 64 20 3a 3d 20 6e 65 | 77 53 74 6f 70 70 65 64 |ed := ne|wStopped|
|00004a80| 3b 0d 09 09 53 65 74 50 | 6f 72 74 28 77 69 6e 64 |;...SetP|ort(wind|
|00004a90| 6f 77 29 3b 0d 09 09 49 | 6e 76 61 6c 52 65 63 74 |ow);...I|nvalRect|
|00004aa0| 28 77 69 6e 64 6f 77 5e | 2e 70 6f 72 74 52 65 63 |(window^|.portRec|
|00004ab0| 74 29 3b 0d 09 45 4e 44 | 3b 0d 45 4e 44 3b 20 7b |t);..END|;.END; {|
|00004ac0| 53 65 74 4c 69 67 68 74 | 7d 0d 0d 0d 7b 24 53 20 |SetLight|}...{$S |
|00004ad0| 4d 61 69 6e 7d 0d 50 52 | 4f 43 45 44 55 52 45 20 |Main}.PR|OCEDURE |
|00004ae0| 41 64 6a 75 73 74 4d 65 | 6e 75 73 3b 0d 0d 7b 45 |AdjustMe|nus;..{E|
|00004af0| 6e 61 62 6c 65 20 61 6e | 64 20 64 69 73 61 62 6c |nable an|d disabl|
|00004b00| 65 20 6d 65 6e 75 73 20 | 62 61 73 65 64 20 6f 6e |e menus |based on|
|00004b10| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 73 74 61 | the cur|rent sta|
|00004b20| 74 65 2e 0d 20 54 68 65 | 20 75 73 65 72 20 63 61 |te.. The| user ca|
|00004b30| 6e 20 6f 6e 6c 79 20 73 | 65 6c 65 63 74 20 65 6e |n only s|elect en|
|00004b40| 61 62 6c 65 64 20 6d 65 | 6e 75 20 69 74 65 6d 73 |abled me|nu items|
|00004b50| 2e 20 57 65 20 73 65 74 | 20 75 70 20 61 6c 6c 20 |. We set| up all |
|00004b60| 74 68 65 20 6d 65 6e 75 | 20 69 74 65 6d 73 0d 20 |the menu| items. |
|00004b70| 62 65 66 6f 72 65 20 63 | 61 6c 6c 69 6e 67 20 4d |before c|alling M|
|00004b80| 65 6e 75 53 65 6c 65 63 | 74 20 6f 72 20 4d 65 6e |enuSelec|t or Men|
|00004b90| 75 4b 65 79 2c 20 73 69 | 6e 63 65 20 74 68 65 73 |uKey, si|nce thes|
|00004ba0| 65 20 61 72 65 20 74 68 | 65 20 6f 6e 6c 79 20 74 |e are th|e only t|
|00004bb0| 69 6d 65 73 20 74 68 61 | 74 0d 20 61 20 6d 65 6e |imes tha|t. a men|
|00004bc0| 75 20 69 74 65 6d 20 63 | 61 6e 20 62 65 20 73 65 |u item c|an be se|
|00004bd0| 6c 65 63 74 65 64 2e 20 | 4e 6f 74 65 20 74 68 61 |lected. |Note tha|
|00004be0| 74 20 4d 65 6e 75 53 65 | 6c 65 63 74 20 69 73 20 |t MenuSe|lect is |
|00004bf0| 61 6c 73 6f 20 74 68 65 | 20 6f 6e 6c 79 20 74 69 |also the| only ti|
|00004c00| 6d 65 0d 20 74 68 65 20 | 75 73 65 72 20 77 69 6c |me. the |user wil|
|00004c10| 6c 20 73 65 65 20 6d 65 | 6e 75 20 69 74 65 6d 73 |l see me|nu items|
|00004c20| 2e 20 54 68 69 73 20 61 | 70 70 72 6f 61 63 68 20 |. This a|pproach |
|00004c30| 74 6f 20 64 65 63 69 64 | 69 6e 67 20 77 68 61 74 |to decid|ing what|
|00004c40| 20 65 6e 61 62 6c 65 2f | 0d 20 64 69 73 61 62 6c | enable/|. disabl|
|00004c50| 65 20 73 74 61 74 65 20 | 61 20 6d 65 6e 75 20 69 |e state |a menu i|
|00004c60| 74 65 6d 20 68 61 73 20 | 74 68 65 20 61 64 76 61 |tem has |the adva|
|00004c70| 6e 74 61 67 65 20 6f 66 | 20 63 6f 6e 63 65 6e 74 |ntage of| concent|
|00004c80| 72 61 74 69 6e 67 20 61 | 6c 6c 20 74 68 65 20 64 |rating a|ll the d|
|00004c90| 65 63 69 73 69 6f 6e 2d | 0d 20 6d 61 6b 69 6e 67 |ecision-|. making|
|00004ca0| 20 69 6e 20 6f 6e 65 20 | 72 6f 75 74 69 6e 65 2c | in one |routine,|
|00004cb0| 20 61 73 20 6f 70 70 6f | 73 65 64 20 74 6f 20 62 | as oppo|sed to b|
|00004cc0| 65 69 6e 67 20 73 70 72 | 65 61 64 20 74 68 72 6f |eing spr|ead thro|
|00004cd0| 75 67 68 6f 75 74 20 74 | 68 65 20 61 70 70 6c 69 |ughout t|he appli|
|00004ce0| 63 61 74 69 6f 6e 2e 0d | 20 4f 74 68 65 72 20 61 |cation..| Other a|
|00004cf0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 64 65 73 69 67 |pplicati|on desig|
|00004d00| 6e 73 20 6d 61 79 20 74 | 61 6b 65 20 61 20 64 69 |ns may t|ake a di|
|00004d10| 66 66 65 72 65 6e 74 20 | 61 70 70 72 6f 61 63 68 |fferent |approach|
|00004d20| 20 74 68 61 74 20 6d 61 | 79 20 6f 72 20 6d 61 79 | that ma|y or may|
|00004d30| 20 6e 6f 74 20 62 65 0d | 20 6a 75 73 74 20 61 73 | not be.| just as|
|00004d40| 20 76 61 6c 69 64 2e 7d | 0d 0d 56 41 52 0d 09 77 | valid.}|..VAR..w|
|00004d50| 69 6e 64 6f 77 09 09 09 | 3a 20 57 69 6e 64 6f 77 |indow...|: Window|
|00004d60| 50 74 72 3b 0d 09 6d 65 | 6e 75 09 09 09 3a 20 4d |Ptr;..me|nu...: M|
|00004d70| 65 6e 75 48 61 6e 64 6c | 65 3b 0d 0d 42 45 47 49 |enuHandl|e;..BEGI|
|00004d80| 4e 0d 09 77 69 6e 64 6f | 77 20 3a 3d 20 46 72 6f |N..windo|w := Fro|
|00004d90| 6e 74 57 69 6e 64 6f 77 | 3b 0d 0d 09 6d 65 6e 75 |ntWindow|;...menu|
|00004da0| 20 3a 3d 20 47 65 74 4d | 48 61 6e 64 6c 65 28 6d | := GetM|Handle(m|
|00004db0| 46 69 6c 65 29 3b 0d 09 | 49 46 20 49 73 44 41 57 |File);..|IF IsDAW|
|00004dc0| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 20 54 48 |indow(wi|ndow) TH|
|00004dd0| 45 4e 09 09 09 09 7b 77 | 65 20 63 61 6e 20 61 6c |EN....{w|e can al|
|00004de0| 6c 6f 77 20 64 65 73 6b | 20 61 63 63 65 73 73 6f |low desk| accesso|
|00004df0| 72 69 65 73 20 74 6f 20 | 62 65 20 63 6c 6f 73 65 |ries to |be close|
|00004e00| 64 20 66 72 6f 6d 20 74 | 68 65 20 6d 65 6e 75 7d |d from t|he menu}|
|00004e10| 0d 09 09 45 6e 61 62 6c | 65 49 74 65 6d 28 6d 65 |...Enabl|eItem(me|
|00004e20| 6e 75 2c 20 69 43 6c 6f | 73 65 29 0d 09 45 4c 53 |nu, iClo|se)..ELS|
|00004e30| 45 0d 09 09 44 69 73 61 | 62 6c 65 49 74 65 6d 28 |E...Disa|bleItem(|
|00004e40| 6d 65 6e 75 2c 20 69 43 | 6c 6f 73 65 29 3b 09 09 |menu, iC|lose);..|
|00004e50| 09 7b 62 75 74 20 6e 6f | 74 20 6f 75 72 20 74 72 |.{but no|t our tr|
|00004e60| 61 66 66 69 63 20 6c 69 | 67 68 74 20 77 69 6e 64 |affic li|ght wind|
|00004e70| 6f 77 7d 0d 0d 09 6d 65 | 6e 75 20 3a 3d 20 47 65 |ow}...me|nu := Ge|
|00004e80| 74 4d 48 61 6e 64 6c 65 | 28 6d 45 64 69 74 29 3b |tMHandle|(mEdit);|
|00004e90| 0d 09 49 46 20 49 73 44 | 41 57 69 6e 64 6f 77 28 |..IF IsD|AWindow(|
|00004ea0| 77 69 6e 64 6f 77 29 20 | 54 48 45 4e 20 42 45 47 |window) |THEN BEG|
|00004eb0| 49 4e 09 09 7b 61 20 64 | 65 73 6b 20 61 63 63 65 |IN..{a d|esk acce|
|00004ec0| 73 73 6f 72 79 20 6d 69 | 67 68 74 20 6e 65 65 64 |ssory mi|ght need|
|00004ed0| 20 74 68 65 20 65 64 69 | 74 20 6d 65 6e 75 7d 0d | the edi|t menu}.|
|00004ee0| 09 09 45 6e 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e |..Enable|Item(men|
|00004ef0| 75 2c 20 69 55 6e 64 6f | 29 3b 0d 09 09 45 6e 61 |u, iUndo|);...Ena|
|00004f00| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 43 |bleItem(|menu, iC|
|00004f10| 75 74 29 3b 0d 09 09 45 | 6e 61 62 6c 65 49 74 65 |ut);...E|nableIte|
|00004f20| 6d 28 6d 65 6e 75 2c 20 | 69 43 6f 70 79 29 3b 0d |m(menu, |iCopy);.|
|00004f30| 09 09 45 6e 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e |..Enable|Item(men|
|00004f40| 75 2c 20 69 50 61 73 74 | 65 29 3b 0d 09 09 45 6e |u, iPast|e);...En|
|00004f50| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|00004f60| 43 6c 65 61 72 29 3b 0d | 09 45 4e 44 20 45 4c 53 |Clear);.|.END ELS|
|00004f70| 45 20 42 45 47 49 4e 09 | 09 09 09 09 09 09 7b 62 |E BEGIN.|......{b|
|00004f80| 75 74 20 77 65 20 6b 6e | 6f 77 20 77 65 20 64 6f |ut we kn|ow we do|
|00004f90| 20 6e 6f 74 7d 0d 09 09 | 44 69 73 61 62 6c 65 49 | not}...|DisableI|
|00004fa0| 74 65 6d 28 6d 65 6e 75 | 2c 20 69 55 6e 64 6f 29 |tem(menu|, iUndo)|
|00004fb0| 3b 0d 09 09 44 69 73 61 | 62 6c 65 49 74 65 6d 28 |;...Disa|bleItem(|
|00004fc0| 6d 65 6e 75 2c 20 69 43 | 75 74 29 3b 0d 09 09 44 |menu, iC|ut);...D|
|00004fd0| 69 73 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |isableIt|em(menu,|
|00004fe0| 20 69 43 6f 70 79 29 3b | 0d 09 09 44 69 73 61 62 | iCopy);|...Disab|
|00004ff0| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 43 6c |leItem(m|enu, iCl|
|00005000| 65 61 72 29 3b 0d 09 09 | 44 69 73 61 62 6c 65 49 |ear);...|DisableI|
|00005010| 74 65 6d 28 6d 65 6e 75 | 2c 20 69 50 61 73 74 65 |tem(menu|, iPaste|
|00005020| 29 3b 0d 09 45 4e 44 3b | 0d 0d 09 6d 65 6e 75 20 |);..END;|...menu |
|00005030| 3a 3d 20 47 65 74 4d 48 | 61 6e 64 6c 65 28 6d 4c |:= GetMH|andle(mL|
|00005040| 69 67 68 74 29 3b 0d 09 | 49 46 20 49 73 41 70 70 |ight);..|IF IsApp|
|00005050| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 20 54 |Window(w|indow) T|
|00005060| 48 45 4e 20 42 45 47 49 | 4e 09 09 7b 77 65 20 6b |HEN BEGI|N..{we k|
|00005070| 6e 6f 77 20 74 68 61 74 | 20 69 74 20 6d 75 73 74 |now that| it must|
|00005080| 20 62 65 20 74 68 65 20 | 74 72 61 66 66 69 63 20 | be the |traffic |
|00005090| 6c 69 67 68 74 7d 0d 09 | 09 45 6e 61 62 6c 65 49 |light}..|.EnableI|
|000050a0| 74 65 6d 28 6d 65 6e 75 | 2c 20 69 53 74 6f 70 29 |tem(menu|, iStop)|
|000050b0| 3b 0d 09 09 45 6e 61 62 | 6c 65 49 74 65 6d 28 6d |;...Enab|leItem(m|
|000050c0| 65 6e 75 2c 20 69 47 6f | 29 3b 0d 09 45 4e 44 20 |enu, iGo|);..END |
|000050d0| 45 4c 53 45 20 42 45 47 | 49 4e 0d 09 09 44 69 73 |ELSE BEG|IN...Dis|
|000050e0| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|000050f0| 53 74 6f 70 29 3b 0d 09 | 09 44 69 73 61 62 6c 65 |Stop);..|.Disable|
|00005100| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 47 6f 29 3b |Item(men|u, iGo);|
|00005110| 0d 09 45 4e 44 3b 0d 09 | 43 68 65 63 6b 49 74 65 |..END;..|CheckIte|
|00005120| 6d 28 6d 65 6e 75 2c 20 | 69 53 74 6f 70 2c 20 67 |m(menu, |iStop, g|
|00005130| 53 74 6f 70 70 65 64 29 | 3b 09 09 7b 77 65 20 63 |Stopped)|;..{we c|
|00005140| 61 6e 20 61 6c 73 6f 20 | 64 65 74 65 72 6d 69 6e |an also |determin|
|00005150| 65 20 63 68 65 63 6b 2f | 75 6e 63 68 65 63 6b 20 |e check/|uncheck |
|00005160| 73 74 61 74 65 2c 20 74 | 6f 6f 7d 0d 09 43 68 65 |state, t|oo}..Che|
|00005170| 63 6b 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 47 6f |ckItem(m|enu, iGo|
|00005180| 2c 20 4e 4f 54 20 67 53 | 74 6f 70 70 65 64 29 3b |, NOT gS|topped);|
|00005190| 0d 45 4e 44 3b 20 7b 41 | 64 6a 75 73 74 4d 65 6e |.END; {A|djustMen|
|000051a0| 75 73 7d 0d 0d 0d 7b 24 | 53 20 4d 61 69 6e 7d 0d |us}...{$|S Main}.|
|000051b0| 50 52 4f 43 45 44 55 52 | 45 20 44 6f 4d 65 6e 75 |PROCEDUR|E DoMenu|
|000051c0| 43 6f 6d 6d 61 6e 64 28 | 6d 65 6e 75 52 65 73 75 |Command(|menuResu|
|000051d0| 6c 74 3a 20 4c 4f 4e 47 | 49 4e 54 29 3b 0d 0d 7b |lt: LONG|INT);..{|
|000051e0| 54 68 69 73 20 69 73 20 | 63 61 6c 6c 65 64 20 77 |This is |called w|
|000051f0| 68 65 6e 20 61 6e 20 69 | 74 65 6d 20 69 73 20 63 |hen an i|tem is c|
|00005200| 68 6f 73 65 6e 20 66 72 | 6f 6d 20 74 68 65 20 6d |hosen fr|om the m|
|00005210| 65 6e 75 20 62 61 72 20 | 28 61 66 74 65 72 20 63 |enu bar |(after c|
|00005220| 61 6c 6c 69 6e 67 0d 20 | 4d 65 6e 75 53 65 6c 65 |alling. |MenuSele|
|00005230| 63 74 20 6f 72 20 4d 65 | 6e 75 4b 65 79 29 2e 20 |ct or Me|nuKey). |
|00005240| 49 74 20 70 65 72 66 6f | 72 6d 73 20 74 68 65 20 |It perfo|rms the |
|00005250| 72 69 67 68 74 20 6f 70 | 65 72 61 74 69 6f 6e 20 |right op|eration |
|00005260| 66 6f 72 20 65 61 63 68 | 20 63 6f 6d 6d 61 6e 64 |for each| command|
|00005270| 2e 0d 20 49 74 20 69 73 | 20 67 6f 6f 64 20 74 6f |.. It is| good to|
|00005280| 20 68 61 76 65 20 62 6f | 74 68 20 74 68 65 20 72 | have bo|th the r|
|00005290| 65 73 75 6c 74 20 6f 66 | 20 4d 65 6e 75 53 65 6c |esult of| MenuSel|
|000052a0| 65 63 74 20 61 6e 64 20 | 4d 65 6e 75 4b 65 79 20 |ect and |MenuKey |
|000052b0| 67 6f 20 74 6f 0d 20 6f | 6e 65 20 72 6f 75 74 69 |go to. o|ne routi|
|000052c0| 6e 65 20 6c 69 6b 65 20 | 74 68 69 73 20 74 6f 20 |ne like |this to |
|000052d0| 6b 65 65 70 20 65 76 65 | 72 79 74 68 69 6e 67 20 |keep eve|rything |
|000052e0| 6f 72 67 61 6e 69 7a 65 | 64 2e 7d 0d 0d 56 41 52 |organize|d.}..VAR|
|000052f0| 0d 09 6d 65 6e 75 49 44 | 09 09 09 3a 20 49 4e 54 |..menuID|...: INT|
|00005300| 45 47 45 52 3b 09 09 7b | 74 68 65 20 72 65 73 6f |EGER;..{|the reso|
|00005310| 75 72 63 65 20 49 44 20 | 6f 66 20 74 68 65 20 73 |urce ID |of the s|
|00005320| 65 6c 65 63 74 65 64 20 | 6d 65 6e 75 7d 0d 09 6d |elected |menu}..m|
|00005330| 65 6e 75 49 74 65 6d 09 | 09 3a 20 49 4e 54 45 47 |enuItem.|.: INTEG|
|00005340| 45 52 3b 09 09 7b 74 68 | 65 20 69 74 65 6d 20 6e |ER;..{th|e item n|
|00005350| 75 6d 62 65 72 20 6f 66 | 20 74 68 65 20 73 65 6c |umber of| the sel|
|00005360| 65 63 74 65 64 20 6d 65 | 6e 75 7d 0d 09 69 74 65 |ected me|nu}..ite|
|00005370| 6d 48 69 74 09 09 09 3a | 20 49 4e 54 45 47 45 52 |mHit...:| INTEGER|
|00005380| 3b 0d 09 64 61 4e 61 6d | 65 09 09 09 3a 20 53 74 |;..daNam|e...: St|
|00005390| 72 32 35 35 3b 0d 09 64 | 61 52 65 66 4e 75 6d 09 |r255;..d|aRefNum.|
|000053a0| 09 3a 20 49 4e 54 45 47 | 45 52 3b 0d 09 68 61 6e |.: INTEG|ER;..han|
|000053b0| 64 6c 65 64 42 79 44 41 | 09 09 3a 20 42 4f 4f 4c |dledByDA|..: BOOL|
|000053c0| 45 41 4e 3b 0d 09 69 67 | 6e 6f 72 65 09 09 09 3a |EAN;..ig|nore...:|
|000053d0| 20 42 4f 4f 4c 45 41 4e | 3b 0d 0d 42 45 47 49 4e | BOOLEAN|;..BEGIN|
|000053e0| 0d 09 6d 65 6e 75 49 44 | 20 3a 3d 20 48 69 57 72 |..menuID| := HiWr|
|000053f0| 64 28 6d 65 6e 75 52 65 | 73 75 6c 74 29 3b 09 7b |d(menuRe|sult);.{|
|00005400| 75 73 65 20 62 75 69 6c | 74 2d 69 6e 73 20 28 66 |use buil|t-ins (f|
|00005410| 6f 72 20 65 66 66 69 63 | 69 65 6e 63 79 29 2e 2e |or effic|iency)..|
|00005420| 2e 7d 0d 09 6d 65 6e 75 | 49 74 65 6d 20 3a 3d 20 |.}..menu|Item := |
|00005430| 4c 6f 57 72 64 28 6d 65 | 6e 75 52 65 73 75 6c 74 |LoWrd(me|nuResult|
|00005440| 29 3b 09 7b 74 6f 20 67 | 65 74 20 6d 65 6e 75 20 |);.{to g|et menu |
|00005450| 69 74 65 6d 20 6e 75 6d | 62 65 72 20 61 6e 64 20 |item num|ber and |
|00005460| 6d 65 6e 75 20 6e 75 6d | 62 65 72 7d 0d 09 43 41 |menu num|ber}..CA|
|00005470| 53 45 20 6d 65 6e 75 49 | 44 20 4f 46 0d 09 09 6d |SE menuI|D OF...m|
|00005480| 41 70 70 6c 65 3a 0d 09 | 09 09 43 41 53 45 20 6d |Apple:..|..CASE m|
|00005490| 65 6e 75 49 74 65 6d 20 | 4f 46 0d 09 09 09 09 69 |enuItem |OF.....i|
|000054a0| 41 62 6f 75 74 3a 09 09 | 09 09 7b 62 72 69 6e 67 |About:..|..{bring|
|000054b0| 20 75 70 20 61 6c 65 72 | 74 20 66 6f 72 20 41 62 | up aler|t for Ab|
|000054c0| 6f 75 74 7d 0d 09 09 09 | 09 09 69 74 65 6d 48 69 |out}....|..itemHi|
|000054d0| 74 20 3a 3d 20 41 6c 65 | 72 74 28 72 41 62 6f 75 |t := Ale|rt(rAbou|
|000054e0| 74 41 6c 65 72 74 2c 20 | 4e 49 4c 29 3b 0d 09 09 |tAlert, |NIL);...|
|000054f0| 09 09 4f 54 48 45 52 57 | 49 53 45 20 42 45 47 49 |..OTHERW|ISE BEGI|
|00005500| 4e 09 09 7b 61 6c 6c 20 | 6e 6f 6e 2d 41 62 6f 75 |N..{all |non-Abou|
|00005510| 74 20 69 74 65 6d 73 20 | 69 6e 20 74 68 69 73 20 |t items |in this |
|00005520| 6d 65 6e 75 20 61 72 65 | 20 44 41 73 7d 0d 09 09 |menu are| DAs}...|
|00005530| 09 09 09 47 65 74 49 74 | 65 6d 28 47 65 74 4d 48 |...GetIt|em(GetMH|
|00005540| 61 6e 64 6c 65 28 6d 41 | 70 70 6c 65 29 2c 20 6d |andle(mA|pple), m|
|00005550| 65 6e 75 49 74 65 6d 2c | 20 64 61 4e 61 6d 65 29 |enuItem,| daName)|
|00005560| 3b 0d 09 09 09 09 09 64 | 61 52 65 66 4e 75 6d 20 |;......d|aRefNum |
|00005570| 3a 3d 20 4f 70 65 6e 44 | 65 73 6b 41 63 63 28 64 |:= OpenD|eskAcc(d|
|00005580| 61 4e 61 6d 65 29 3b 0d | 09 09 09 09 45 4e 44 3b |aName);.|....END;|
|00005590| 0d 09 09 09 45 4e 44 3b | 0d 09 09 6d 46 69 6c 65 |....END;|...mFile|
|000055a0| 3a 0d 09 09 09 43 41 53 | 45 20 6d 65 6e 75 49 74 |:....CAS|E menuIt|
|000055b0| 65 6d 20 4f 46 0d 09 09 | 09 09 69 43 6c 6f 73 65 |em OF...|..iClose|
|000055c0| 3a 0d 09 09 09 09 09 69 | 67 6e 6f 72 65 20 3a 3d |:......i|gnore :=|
|000055d0| 20 44 6f 43 6c 6f 73 65 | 57 69 6e 64 6f 77 28 46 | DoClose|Window(F|
|000055e0| 72 6f 6e 74 57 69 6e 64 | 6f 77 29 3b 20 7b 77 65 |rontWind|ow); {we|
|000055f0| 20 64 6f 6e 27 74 20 63 | 61 72 65 20 69 66 20 63 | don't c|are if c|
|00005600| 61 6e 63 65 6c 6c 65 64 | 7d 0d 09 09 09 09 69 51 |ancelled|}.....iQ|
|00005610| 75 69 74 3a 0d 09 09 09 | 09 09 54 65 72 6d 69 6e |uit:....|..Termin|
|00005620| 61 74 65 3b 0d 09 09 09 | 45 4e 44 3b 0d 09 09 6d |ate;....|END;...m|
|00005630| 45 64 69 74 3a 09 09 09 | 09 09 09 7b 63 61 6c 6c |Edit:...|...{call|
|00005640| 20 53 79 73 74 65 6d 45 | 64 69 74 20 66 6f 72 20 | SystemE|dit for |
|00005650| 44 41 20 65 64 69 74 69 | 6e 67 20 26 20 4d 75 6c |DA editi|ng & Mul|
|00005660| 74 69 46 69 6e 64 65 72 | 7d 0d 09 09 09 68 61 6e |tiFinder|}....han|
|00005670| 64 6c 65 64 42 79 44 41 | 20 3a 3d 20 53 79 73 74 |dledByDA| := Syst|
|00005680| 65 6d 45 64 69 74 28 6d | 65 6e 75 49 74 65 6d 2d |emEdit(m|enuItem-|
|00005690| 31 29 3b 09 7b 73 69 6e | 63 65 20 77 65 20 64 6f |1);.{sin|ce we do|
|000056a0| 6e 27 74 20 64 6f 20 61 | 6e 79 20 65 64 69 74 69 |n't do a|ny editi|
|000056b0| 6e 67 7d 0d 09 09 6d 4c | 69 67 68 74 3a 0d 09 09 |ng}...mL|ight:...|
|000056c0| 09 43 41 53 45 20 6d 65 | 6e 75 49 74 65 6d 20 4f |.CASE me|nuItem O|
|000056d0| 46 0d 09 09 09 09 69 53 | 74 6f 70 3a 0d 09 09 09 |F.....iS|top:....|
|000056e0| 09 09 53 65 74 4c 69 67 | 68 74 28 46 72 6f 6e 74 |..SetLig|ht(Front|
|000056f0| 57 69 6e 64 6f 77 2c 20 | 54 52 55 45 29 3b 0d 09 |Window, |TRUE);..|
|00005700| 09 09 09 69 47 6f 3a 0d | 09 09 09 09 09 53 65 74 |...iGo:.|.....Set|
|00005710| 4c 69 67 68 74 28 46 72 | 6f 6e 74 57 69 6e 64 6f |Light(Fr|ontWindo|
|00005720| 77 2c 20 46 41 4c 53 45 | 29 3b 0d 09 09 09 45 4e |w, FALSE|);....EN|
|00005730| 44 3b 0d 09 45 4e 44 3b | 0d 09 48 69 6c 69 74 65 |D;..END;|..Hilite|
|00005740| 4d 65 6e 75 28 30 29 3b | 09 09 09 09 09 7b 75 6e |Menu(0);|.....{un|
|00005750| 68 69 67 68 6c 69 67 68 | 74 20 77 68 61 74 20 4d |highligh|t what M|
|00005760| 65 6e 75 53 65 6c 65 63 | 74 20 28 6f 72 20 4d 65 |enuSelec|t (or Me|
|00005770| 6e 75 4b 65 79 29 20 68 | 69 6c 69 74 65 64 7d 0d |nuKey) h|ilited}.|
|00005780| 45 4e 44 3b 20 7b 44 6f | 4d 65 6e 75 43 6f 6d 6d |END; {Do|MenuComm|
|00005790| 61 6e 64 7d 0d 0d 0d 7b | 24 53 20 4d 61 69 6e 7d |and}...{|$S Main}|
|000057a0| 0d 50 52 4f 43 45 44 55 | 52 45 20 44 72 61 77 57 |.PROCEDU|RE DrawW|
|000057b0| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 3a 20 57 69 |indow(wi|ndow: Wi|
|000057c0| 6e 64 6f 77 50 74 72 29 | 3b 0d 0d 7b 44 72 61 77 |ndowPtr)|;..{Draw|
|000057d0| 20 74 68 65 20 63 6f 6e | 74 65 6e 74 73 20 6f 66 | the con|tents of|
|000057e0| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|000057f0| 20 77 69 6e 64 6f 77 2e | 20 57 65 20 64 6f 20 73 | window.| We do s|
|00005800| 6f 6d 65 20 64 72 61 77 | 69 6e 67 20 69 6e 20 63 |ome draw|ing in c|
|00005810| 6f 6c 6f 72 2c 20 75 73 | 69 6e 67 0d 20 43 6c 61 |olor, us|ing. Cla|
|00005820| 73 73 69 63 20 51 75 69 | 63 6b 44 72 61 77 27 73 |ssic Qui|ckDraw's|
|00005830| 20 63 6f 6c 6f 72 20 63 | 61 70 61 62 69 6c 69 74 | color c|apabilit|
|00005840| 69 65 73 2e 20 54 68 69 | 73 20 77 69 6c 6c 20 62 |ies. Thi|s will b|
|00005850| 65 20 62 6c 61 63 6b 20 | 61 6e 64 20 77 68 69 74 |e black |and whit|
|00005860| 65 20 6f 6e 20 6f 6c 64 | 0d 20 6d 61 63 68 69 6e |e on old|. machin|
|00005870| 65 73 2c 20 62 75 74 20 | 63 6f 6c 6f 72 20 6f 6e |es, but |color on|
|00005880| 20 63 6f 6c 6f 72 20 6d | 61 63 68 69 6e 65 73 2e | color m|achines.|
|00005890| 20 41 74 20 74 68 69 73 | 20 70 6f 69 6e 74 2c 20 | At this| point, |
|000058a0| 74 68 65 20 77 69 6e 64 | 6f 77 27 73 20 76 69 73 |the wind|ow's vis|
|000058b0| 52 67 6e 20 69 73 0d 20 | 73 65 74 20 74 6f 20 61 |Rgn is. |set to a|
|000058c0| 6c 6c 6f 77 20 64 72 61 | 77 69 6e 67 20 6f 6e 6c |llow dra|wing onl|
|000058d0| 79 20 77 68 65 72 65 20 | 69 74 20 6e 65 65 64 73 |y where |it needs|
|000058e0| 20 74 6f 20 62 65 20 64 | 6f 6e 65 2e 7d 0d 0d 42 | to be d|one.}..B|
|000058f0| 45 47 49 4e 0d 09 53 65 | 74 50 6f 72 74 28 77 69 |EGIN..Se|tPort(wi|
|00005900| 6e 64 6f 77 29 3b 0d 0d | 09 45 72 61 73 65 52 65 |ndow);..|.EraseRe|
|00005910| 63 74 28 77 69 6e 64 6f | 77 5e 2e 70 6f 72 74 52 |ct(windo|w^.portR|
|00005920| 65 63 74 29 3b 09 7b 63 | 6c 65 61 72 20 6f 75 74 |ect);.{c|lear out|
|00005930| 20 61 6e 79 20 67 61 72 | 62 61 67 65 20 74 68 61 | any gar|bage tha|
|00005940| 74 20 6d 69 67 68 74 20 | 62 65 20 6c 65 66 74 20 |t might |be left |
|00005950| 62 65 68 69 6e 64 7d 0d | 09 49 46 20 67 53 74 6f |behind}.|.IF gSto|
|00005960| 70 70 65 64 20 54 48 45 | 4e 09 09 09 09 7b 64 72 |pped THE|N....{dr|
|00005970| 61 77 20 61 20 72 65 64 | 20 28 6f 72 20 77 68 69 |aw a red| (or whi|
|00005980| 74 65 29 20 73 74 6f 70 | 20 6c 69 67 68 74 7d 0d |te) stop| light}.|
|00005990| 09 09 46 6f 72 65 43 6f | 6c 6f 72 28 72 65 64 43 |..ForeCo|lor(redC|
|000059a0| 6f 6c 6f 72 29 0d 09 45 | 4c 53 45 0d 09 09 46 6f |olor)..E|LSE...Fo|
|000059b0| 72 65 43 6f 6c 6f 72 28 | 77 68 69 74 65 43 6f 6c |reColor(|whiteCol|
|000059c0| 6f 72 29 3b 0d 09 50 61 | 69 6e 74 4f 76 61 6c 28 |or);..Pa|intOval(|
|000059d0| 67 53 74 6f 70 52 65 63 | 74 29 3b 0d 09 46 6f 72 |gStopRec|t);..For|
|000059e0| 65 43 6f 6c 6f 72 28 62 | 6c 61 63 6b 43 6f 6c 6f |eColor(b|lackColo|
|000059f0| 72 29 3b 0d 09 46 72 61 | 6d 65 4f 76 61 6c 28 67 |r);..Fra|meOval(g|
|00005a00| 53 74 6f 70 52 65 63 74 | 29 3b 0d 09 49 46 20 4e |StopRect|);..IF N|
|00005a10| 4f 54 20 67 53 74 6f 70 | 70 65 64 20 54 48 45 4e |OT gStop|ped THEN|
|00005a20| 09 09 09 7b 64 72 61 77 | 20 61 20 67 72 65 65 6e |...{draw| a green|
|00005a30| 20 28 6f 72 20 77 68 69 | 74 65 29 20 67 6f 20 6c | (or whi|te) go l|
|00005a40| 69 67 68 74 7d 0d 09 09 | 46 6f 72 65 43 6f 6c 6f |ight}...|ForeColo|
|00005a50| 72 28 67 72 65 65 6e 43 | 6f 6c 6f 72 29 0d 09 45 |r(greenC|olor)..E|
|00005a60| 4c 53 45 0d 09 09 46 6f | 72 65 43 6f 6c 6f 72 28 |LSE...Fo|reColor(|
|00005a70| 77 68 69 74 65 43 6f 6c | 6f 72 29 3b 0d 09 50 61 |whiteCol|or);..Pa|
|00005a80| 69 6e 74 4f 76 61 6c 28 | 67 47 6f 52 65 63 74 29 |intOval(|gGoRect)|
|00005a90| 3b 0d 09 46 6f 72 65 43 | 6f 6c 6f 72 28 62 6c 61 |;..ForeC|olor(bla|
|00005aa0| 63 6b 43 6f 6c 6f 72 29 | 3b 0d 09 46 72 61 6d 65 |ckColor)|;..Frame|
|00005ab0| 4f 76 61 6c 28 67 47 6f | 52 65 63 74 29 3b 0d 45 |Oval(gGo|Rect);.E|
|00005ac0| 4e 44 3b 20 7b 44 72 61 | 77 57 69 6e 64 6f 77 7d |ND; {Dra|wWindow}|
|00005ad0| 0d 0d 0d 7b 24 53 20 4d | 61 69 6e 7d 0d 50 52 4f |...{$S M|ain}.PRO|
|00005ae0| 43 45 44 55 52 45 20 44 | 6f 43 6f 6e 74 65 6e 74 |CEDURE D|oContent|
|00005af0| 43 6c 69 63 6b 28 77 69 | 6e 64 6f 77 3a 20 57 69 |Click(wi|ndow: Wi|
|00005b00| 6e 64 6f 77 50 74 72 3b | 20 65 76 65 6e 74 3a 20 |ndowPtr;| event: |
|00005b10| 45 76 65 6e 74 52 65 63 | 6f 72 64 29 3b 0d 0d 7b |EventRec|ord);..{|
|00005b20| 54 68 69 73 20 69 73 20 | 63 61 6c 6c 65 64 20 77 |This is |called w|
|00005b30| 68 65 6e 20 61 20 6d 6f | 75 73 65 2d 64 6f 77 6e |hen a mo|use-down|
|00005b40| 20 65 76 65 6e 74 20 6f | 63 63 75 72 73 20 69 6e | event o|ccurs in|
|00005b50| 20 74 68 65 20 63 6f 6e | 74 65 6e 74 20 6f 66 20 | the con|tent of |
|00005b60| 61 20 77 69 6e 64 6f 77 | 2e 0d 20 4f 74 68 65 72 |a window|.. Other|
|00005b70| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 73 20 6d 69 | applica|tions mi|
|00005b80| 67 68 74 20 77 61 6e 74 | 20 74 6f 20 63 61 6c 6c |ght want| to call|
|00005b90| 20 46 69 6e 64 43 6f 6e | 74 72 6f 6c 2c 20 54 45 | FindCon|trol, TE|
|00005ba0| 43 6c 69 63 6b 2c 20 65 | 74 63 2e 2c 20 74 6f 0d |Click, e|tc., to.|
|00005bb0| 20 66 75 72 74 68 65 72 | 20 70 72 6f 63 65 73 73 | further| process|
|00005bc0| 20 74 68 65 20 63 6c 69 | 63 6b 2e 7d 0d 0d 42 45 | the cli|ck.}..BE|
|00005bd0| 47 49 4e 0d 09 53 65 74 | 4c 69 67 68 74 28 77 69 |GIN..Set|Light(wi|
|00005be0| 6e 64 6f 77 2c 20 4e 4f | 54 20 67 53 74 6f 70 70 |ndow, NO|T gStopp|
|00005bf0| 65 64 29 3b 0d 45 4e 44 | 3b 20 7b 44 6f 43 6f 6e |ed);.END|; {DoCon|
|00005c00| 74 65 6e 74 43 6c 69 63 | 6b 7d 0d 0d 0d 7b 24 53 |tentClic|k}...{$S|
|00005c10| 20 4d 61 69 6e 7d 0d 50 | 52 4f 43 45 44 55 52 45 | Main}.P|ROCEDURE|
|00005c20| 20 44 6f 55 70 64 61 74 | 65 28 77 69 6e 64 6f 77 | DoUpdat|e(window|
|00005c30| 3a 20 57 69 6e 64 6f 77 | 50 74 72 29 3b 0d 0d 7b |: Window|Ptr);..{|
|00005c40| 54 68 69 73 20 69 73 20 | 63 61 6c 6c 65 64 20 77 |This is |called w|
|00005c50| 68 65 6e 20 61 6e 20 75 | 70 64 61 74 65 20 65 76 |hen an u|pdate ev|
|00005c60| 65 6e 74 20 69 73 20 72 | 65 63 65 69 76 65 64 20 |ent is r|eceived |
|00005c70| 66 6f 72 20 61 20 77 69 | 6e 64 6f 77 2e 0d 20 49 |for a wi|ndow.. I|
|00005c80| 74 20 63 61 6c 6c 73 20 | 44 72 61 77 57 69 6e 64 |t calls |DrawWind|
|00005c90| 6f 77 20 74 6f 20 64 72 | 61 77 20 74 68 65 20 63 |ow to dr|aw the c|
|00005ca0| 6f 6e 74 65 6e 74 73 20 | 6f 66 20 61 6e 20 61 70 |ontents |of an ap|
|00005cb0| 70 6c 69 63 61 74 69 6f | 6e 20 77 69 6e 64 6f 77 |plicatio|n window|
|00005cc0| 2e 0d 20 41 73 20 61 6e | 20 65 66 66 65 63 69 65 |.. As an| effecie|
|00005cd0| 6e 63 79 20 6d 65 61 73 | 75 72 65 20 74 68 61 74 |ncy meas|ure that|
|00005ce0| 20 64 6f 65 73 20 6e 6f | 74 20 68 61 76 65 20 74 | does no|t have t|
|00005cf0| 6f 20 62 65 20 66 6f 6c | 6c 6f 77 65 64 2c 20 69 |o be fol|lowed, i|
|00005d00| 74 0d 20 63 61 6c 6c 73 | 20 74 68 65 20 64 72 61 |t. calls| the dra|
|00005d10| 77 69 6e 67 20 72 6f 75 | 74 69 6e 65 20 6f 6e 6c |wing rou|tine onl|
|00005d20| 79 20 69 66 20 74 68 65 | 20 76 69 73 52 67 6e 20 |y if the| visRgn |
|00005d30| 69 73 20 6e 6f 6e 2d 65 | 6d 70 74 79 2e 20 54 68 |is non-e|mpty. Th|
|00005d40| 69 73 0d 20 77 69 6c 6c | 20 68 61 6e 64 6c 65 20 |is. will| handle |
|00005d50| 73 69 74 75 61 74 69 6f | 6e 73 20 77 68 65 72 65 |situatio|ns where|
|00005d60| 20 63 61 6c 63 75 6c 61 | 74 69 6f 6e 73 20 66 6f | calcula|tions fo|
|00005d70| 72 20 64 72 61 77 69 6e | 67 20 6f 72 20 64 72 61 |r drawin|g or dra|
|00005d80| 77 69 6e 67 0d 20 69 74 | 73 65 6c 66 20 69 73 20 |wing. it|self is |
|00005d90| 76 65 72 79 20 74 69 6d | 65 2d 63 6f 6e 73 75 6d |very tim|e-consum|
|00005da0| 69 6e 67 2e 7d 0d 0d 42 | 45 47 49 4e 0d 09 49 46 |ing.}..B|EGIN..IF|
|00005db0| 20 49 73 41 70 70 57 69 | 6e 64 6f 77 28 77 69 6e | IsAppWi|ndow(win|
|00005dc0| 64 6f 77 29 20 54 48 45 | 4e 20 42 45 47 49 4e 0d |dow) THE|N BEGIN.|
|00005dd0| 09 09 42 65 67 69 6e 55 | 70 64 61 74 65 28 77 69 |..BeginU|pdate(wi|
|00005de0| 6e 64 6f 77 29 3b 09 09 | 09 09 09 7b 73 65 74 73 |ndow);..|...{sets|
|00005df0| 20 75 70 20 74 68 65 20 | 76 69 73 52 67 6e 2c 20 | up the |visRgn, |
|00005e00| 63 6c 65 61 72 73 20 75 | 70 64 61 74 65 52 67 6e |clears u|pdateRgn|
|00005e10| 7d 0d 09 09 49 46 20 4e | 4f 54 20 45 6d 70 74 79 |}...IF N|OT Empty|
|00005e20| 52 67 6e 28 77 69 6e 64 | 6f 77 5e 2e 76 69 73 52 |Rgn(wind|ow^.visR|
|00005e30| 67 6e 29 20 54 48 45 4e | 09 7b 64 72 61 77 20 69 |gn) THEN|.{draw i|
|00005e40| 66 20 75 70 64 61 74 69 | 6e 67 20 6e 65 65 64 73 |f updati|ng needs|
|00005e50| 20 74 6f 20 62 65 20 64 | 6f 6e 65 7d 0d 09 09 09 | to be d|one}....|
|00005e60| 44 72 61 77 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |DrawWind|ow(windo|
|00005e70| 77 29 3b 0d 09 09 45 6e | 64 55 70 64 61 74 65 28 |w);...En|dUpdate(|
|00005e80| 77 69 6e 64 6f 77 29 3b | 09 09 09 09 09 09 7b 72 |window);|......{r|
|00005e90| 65 73 74 6f 72 65 73 20 | 74 68 65 20 76 69 73 52 |estores |the visR|
|00005ea0| 67 6e 7d 0d 09 45 4e 44 | 3b 0d 45 4e 44 3b 20 7b |gn}..END|;.END; {|
|00005eb0| 44 6f 55 70 64 61 74 65 | 7d 0d 0d 0d 7b 24 53 20 |DoUpdate|}...{$S |
|00005ec0| 4d 61 69 6e 7d 0d 50 52 | 4f 43 45 44 55 52 45 20 |Main}.PR|OCEDURE |
|00005ed0| 44 6f 41 63 74 69 76 61 | 74 65 28 77 69 6e 64 6f |DoActiva|te(windo|
|00005ee0| 77 3a 20 57 69 6e 64 6f | 77 50 74 72 3b 20 62 65 |w: Windo|wPtr; be|
|00005ef0| 63 6f 6d 69 6e 67 41 63 | 74 69 76 65 3a 20 42 4f |comingAc|tive: BO|
|00005f00| 4f 4c 45 41 4e 29 3b 0d | 0d 7b 54 68 69 73 20 69 |OLEAN);.|.{This i|
|00005f10| 73 20 63 61 6c 6c 65 64 | 20 77 68 65 6e 20 61 20 |s called| when a |
|00005f20| 77 69 6e 64 6f 77 20 69 | 73 20 61 63 74 69 76 61 |window i|s activa|
|00005f30| 74 65 64 20 6f 72 20 64 | 65 61 63 74 69 76 61 74 |ted or d|eactivat|
|00005f40| 65 64 2e 0d 20 49 6e 20 | 53 61 6d 70 6c 65 2c 20 |ed.. In |Sample, |
|00005f50| 74 68 65 20 57 69 6e 64 | 6f 77 20 4d 61 6e 61 67 |the Wind|ow Manag|
|00005f60| 65 72 27 73 20 68 61 6e | 64 6c 69 6e 67 20 6f 66 |er's han|dling of|
|00005f70| 20 61 63 74 69 76 61 74 | 65 20 61 6e 64 0d 20 64 | activat|e and. d|
|00005f80| 65 61 63 74 69 76 61 74 | 65 20 65 76 65 6e 74 73 |eactivat|e events|
|00005f90| 20 69 73 20 73 75 66 66 | 69 63 69 65 6e 74 2e 20 | is suff|icient. |
|00005fa0| 4f 74 68 65 72 20 61 70 | 70 6c 69 63 61 74 69 6f |Other ap|plicatio|
|00005fb0| 6e 73 20 6d 61 79 20 68 | 61 76 65 0d 20 54 65 78 |ns may h|ave. Tex|
|00005fc0| 74 45 64 69 74 20 72 65 | 63 6f 72 64 73 2c 20 63 |tEdit re|cords, c|
|00005fd0| 6f 6e 74 72 6f 6c 73 2c | 20 6c 69 73 74 73 2c 20 |ontrols,| lists, |
|00005fe0| 65 74 63 2e 2c 20 74 6f | 20 61 63 74 69 76 61 74 |etc., to| activat|
|00005ff0| 65 2f 64 65 61 63 74 69 | 76 61 74 65 2e 7d 0d 0d |e/deacti|vate.}..|
|00006000| 42 45 47 49 4e 0d 09 49 | 46 20 49 73 41 70 70 57 |BEGIN..I|F IsAppW|
|00006010| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 20 54 48 |indow(wi|ndow) TH|
|00006020| 45 4e 0d 09 09 49 46 20 | 62 65 63 6f 6d 69 6e 67 |EN...IF |becoming|
|00006030| 41 63 74 69 76 65 20 54 | 48 45 4e 0d 09 09 09 7b |Active T|HEN....{|
|00006040| 64 6f 20 77 68 61 74 65 | 76 65 72 20 79 6f 75 20 |do whate|ver you |
|00006050| 6e 65 65 64 20 74 6f 20 | 61 74 20 61 63 74 69 76 |need to |at activ|
|00006060| 61 74 69 6f 6e 7d 0d 09 | 09 45 4c 53 45 0d 09 09 |ation}..|.ELSE...|
|00006070| 09 7b 64 6f 20 77 68 61 | 74 65 76 65 72 20 79 6f |.{do wha|tever yo|
|00006080| 75 20 6e 65 65 64 20 74 | 6f 20 61 74 20 64 65 61 |u need t|o at dea|
|00006090| 63 74 69 76 61 74 69 6f | 6e 7d 3b 0d 45 4e 44 3b |ctivatio|n};.END;|
|000060a0| 20 7b 44 6f 41 63 74 69 | 76 61 74 65 7d 0d 0d 0d | {DoActi|vate}...|
|000060b0| 7b 24 53 20 4d 61 69 6e | 7d 0d 50 52 4f 43 45 44 |{$S Main|}.PROCED|
|000060c0| 55 52 45 20 41 64 6a 75 | 73 74 43 75 72 73 6f 72 |URE Adju|stCursor|
|000060d0| 28 6d 6f 75 73 65 3a 20 | 50 6f 69 6e 74 3b 20 72 |(mouse: |Point; r|
|000060e0| 65 67 69 6f 6e 3a 20 52 | 67 6e 48 61 6e 64 6c 65 |egion: R|gnHandle|
|000060f0| 29 3b 0d 0d 7b 43 68 61 | 6e 67 65 20 74 68 65 20 |);..{Cha|nge the |
|00006100| 63 75 72 73 6f 72 27 73 | 20 73 68 61 70 65 2c 20 |cursor's| shape, |
|00006110| 64 65 70 65 6e 64 69 6e | 67 20 6f 6e 20 69 74 73 |dependin|g on its|
|00006120| 20 70 6f 73 69 74 69 6f | 6e 2e 20 54 68 69 73 20 | positio|n. This |
|00006130| 61 6c 73 6f 20 63 61 6c | 63 75 6c 61 74 65 73 20 |also cal|culates |
|00006140| 74 68 65 20 72 65 67 69 | 6f 6e 0d 20 77 68 65 72 |the regi|on. wher|
|00006150| 65 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 63 75 |e the cu|rrent cu|
|00006160| 72 73 6f 72 20 72 65 73 | 69 64 65 73 20 28 66 6f |rsor res|ides (fo|
|00006170| 72 20 57 61 69 74 4e 65 | 78 74 45 76 65 6e 74 29 |r WaitNe|xtEvent)|
|00006180| 2e 20 49 66 20 74 68 65 | 20 6d 6f 75 73 65 20 69 |. If the| mouse i|
|00006190| 73 20 65 76 65 72 20 6f | 75 74 73 69 64 65 20 6f |s ever o|utside o|
|000061a0| 66 0d 20 74 68 61 74 20 | 72 65 67 69 6f 6e 2c 20 |f. that |region, |
|000061b0| 61 6e 20 65 76 65 6e 74 | 20 69 73 20 67 65 6e 65 |an event| is gene|
|000061c0| 72 61 74 65 64 2c 20 63 | 61 75 73 69 6e 67 20 74 |rated, c|ausing t|
|000061d0| 68 69 73 20 72 6f 75 74 | 69 6e 65 20 74 6f 20 62 |his rout|ine to b|
|000061e0| 65 20 63 61 6c 6c 65 64 | 2e 20 54 68 69 73 0d 20 |e called|. This. |
|000061f0| 61 6c 6c 6f 77 73 20 75 | 73 20 74 6f 20 63 68 61 |allows u|s to cha|
|00006200| 6e 67 65 20 74 68 65 20 | 72 65 67 69 6f 6e 20 74 |nge the |region t|
|00006210| 6f 20 74 68 65 20 72 65 | 67 69 6f 6e 20 74 68 65 |o the re|gion the|
|00006220| 20 6d 6f 75 73 65 20 69 | 73 20 63 75 72 72 65 6e | mouse i|s curren|
|00006230| 74 6c 79 20 69 6e 2e 20 | 49 66 0d 20 74 68 65 72 |tly in. |If. ther|
|00006240| 65 20 69 73 20 6d 6f 72 | 65 20 74 6f 20 74 68 65 |e is mor|e to the|
|00006250| 20 65 76 65 6e 74 20 74 | 68 61 6e 20 6a 75 73 74 | event t|han just|
|00006260| 20 d2 74 68 65 20 6d 6f | 75 73 65 20 6d 6f 76 65 | .the mo|use move|
|00006270| 64 d3 2c 20 77 65 20 67 | 65 74 20 63 61 6c 6c 65 |d., we g|et calle|
|00006280| 64 20 62 65 66 6f 72 65 | 20 74 68 65 0d 20 65 76 |d before| the. ev|
|00006290| 65 6e 74 20 69 73 20 70 | 72 6f 63 65 73 73 65 64 |ent is p|rocessed|
|000062a0| 20 74 6f 20 6d 61 6b 65 | 20 73 75 72 65 20 74 68 | to make| sure th|
|000062b0| 65 20 63 75 72 73 6f 72 | 20 69 73 20 74 68 65 20 |e cursor| is the |
|000062c0| 72 69 67 68 74 20 6f 6e | 65 2e 20 49 6e 20 61 6e |right on|e. In an|
|000062d0| 79 20 28 61 68 65 6d 29 | 20 65 76 65 6e 74 2c 0d |y (ahem)| event,.|
|000062e0| 20 74 68 69 73 20 69 73 | 20 63 61 6c 6c 65 64 20 | this is| called |
|000062f0| 61 67 61 69 6e 20 62 65 | 66 6f 72 65 20 77 65 20 |again be|fore we |
|00006300| 66 61 6c 6c 20 62 61 63 | 6b 20 69 6e 74 6f 20 57 |fall bac|k into W|
|00006310| 4e 45 2e 7d 0d 0d 56 41 | 52 0d 09 77 69 6e 64 6f |NE.}..VA|R..windo|
|00006320| 77 09 09 09 09 3a 20 57 | 69 6e 64 6f 77 50 74 72 |w....: W|indowPtr|
|00006330| 3b 0d 09 61 72 72 6f 77 | 52 67 6e 09 09 09 3a 20 |;..arrow|Rgn...: |
|00006340| 52 67 6e 48 61 6e 64 6c | 65 3b 0d 09 70 6c 75 73 |RgnHandl|e;..plus|
|00006350| 52 67 6e 09 09 09 09 3a | 20 52 67 6e 48 61 6e 64 |Rgn....:| RgnHand|
|00006360| 6c 65 3b 0d 09 67 6c 6f | 62 61 6c 50 6f 72 74 52 |le;..glo|balPortR|
|00006370| 65 63 74 09 09 3a 20 52 | 65 63 74 3b 0d 0d 42 45 |ect..: R|ect;..BE|
|00006380| 47 49 4e 0d 09 77 69 6e | 64 6f 77 20 3a 3d 20 46 |GIN..win|dow := F|
|00006390| 72 6f 6e 74 57 69 6e 64 | 6f 77 3b 09 7b 77 65 20 |rontWind|ow;.{we |
|000063a0| 6f 6e 6c 79 20 61 64 6a | 75 73 74 20 74 68 65 20 |only adj|ust the |
|000063b0| 63 75 72 73 6f 72 20 77 | 68 65 6e 20 77 65 20 61 |cursor w|hen we a|
|000063c0| 72 65 20 69 6e 20 66 72 | 6f 6e 74 7d 0d 09 49 46 |re in fr|ont}..IF|
|000063d0| 20 28 4e 4f 54 20 67 49 | 6e 42 61 63 6b 67 72 6f | (NOT gI|nBackgro|
|000063e0| 75 6e 64 29 20 41 4e 44 | 20 28 4e 4f 54 20 49 73 |und) AND| (NOT Is|
|000063f0| 44 41 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 29 |DAWindow|(window)|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.